AWS CLI Setup And the Use of ECR
Elastic Container Registry (ECR) can be used to stored images (eg. docker images), and deployed to AWS ECS or EKS).
Install AWS CLI
- https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2.html.
- Verify
which aws.
Get Access Key From AWS
Create policy (with ECR permission).
Create user, access type choose access key, then attach the policy.
Download the cvs file that has access key ID and secret access key.
Config AWS CLI.
1 | aws configure |
Enter the information.
Push Image to ECR
- Go to AWS ECR.
- Create repository.
- Choose the repository and click on the “View push command” button.
- Copy the first command, should be prompted “Login Succeeded”.
- Run the second command (docker build …) in the directory that has the
Dockerfile
.