https://github.com/greathayat/aws-ecr-docker
This repository will help you to understand, how to push your docker image to AWS ECR
https://github.com/greathayat/aws-ecr-docker
aws aws-containers aws-ecr aws-iam aws-iam-policies docker docker-image private-docker-registry
Last synced: 3 months ago
JSON representation
This repository will help you to understand, how to push your docker image to AWS ECR
- Host: GitHub
- URL: https://github.com/greathayat/aws-ecr-docker
- Owner: GreatHayat
- Created: 2023-03-22T12:56:14.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2023-03-26T21:32:12.000Z (over 3 years ago)
- Last Synced: 2025-03-05T13:52:19.687Z (over 1 year ago)
- Topics: aws, aws-containers, aws-ecr, aws-iam, aws-iam-policies, docker, docker-image, private-docker-registry
- Language: JavaScript
- Homepage:
- Size: 15.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# AWS ECR
`This repository will help you to understand, how to push your docker images to AWS ECR using Github actions`
## STEPS
1. CREATE PRIVATE REPOSITORY IN ECR
- Login to you AWS account
- Go to `AWS Container Registry` service and create a `private` repository
- Create Private Repository with a suitable name
2. CREATE IAM USER
- Create IAM user and create an inline policy
- An Inline policy will allow the IAM user to login to ECR, build and tag docker images and push docker images to `AWS ECR`
### Policy Examples
1. The following policy will enable user to push docker images to `any ECR registry`
```
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"ecr:CompleteLayerUpload",
"ecr:GetAuthorizationToken",
"ecr:UploadLayerPart",
"ecr:InitiateLayerUpload",
"ecr:BatchCheckLayerAvailability",
"ecr:PutImage"
],
"Resource": "*"
}
]
}
```
2. The following policy will enable/restrict user to push docker images to a `specific ECR registry`
```
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"ecr:CompleteLayerUpload",
"ecr:UploadLayerPart",
"ecr:InitiateLayerUpload",
"ecr:BatchCheckLayerAvailability",
"ecr:PutImage"
],
"Resource": "arn:aws:ecr:region:111122223333:repository/repository-name"
},
{
"Effect": "Allow",
"Action": "ecr:GetAuthorizationToken",
"Resource": "*"
}
]
}
```
## How to use the Github Action workFlow (used in this repository)
Set the following secret variables in your repository secrets
- `AWS_ACCESS_KEY_ID`
- `AWS_SECREST_ACCESS_KEY`
- `AWS_ECR_REGION`
- `ECR_REPOSITORY_NAME`
#### HAPPY CLOUD LEARNING