Created
October 1, 2016 21:49
-
-
Save labrute974/52da3f0273e62c6ced5bbafccee044d6 to your computer and use it in GitHub Desktop.
Cloudformation_ecr_role_working
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AWSTemplateFormatVersion: '2010-09-09' | |
Resources: | |
Repository: | |
Type: "AWS::ECR::Repository" | |
Properties: | |
RepositoryPolicyText: | |
Version: "2012-10-17" | |
Statement: | |
- | |
Sid: AllowPushPull | |
Effect: Allow | |
Principal: | |
AWS: | |
- !GetAtt [ "PushRole", "Arn" ] | |
Action: | |
- "ecr:GetDownloadUrlForLayer" | |
- "ecr:BatchGetImage" | |
- "ecr:BatchCheckLayerAvailability" | |
- "ecr:PutImage" | |
- "ecr:InitiateLayerUpload" | |
- "ecr:UploadLayerPart" | |
- "ecr:CompleteLayerUpload" | |
PushRole: | |
Type: "AWS::IAM::Role" | |
Properties: | |
Path: "/application/" | |
RoleName: "registry-push" | |
AssumeRolePolicyDocument: | |
Version: "2012-10-17" | |
Statement: | |
- | |
Effect: "Allow" | |
Principal: | |
Service: | |
- "ec2.amazonaws.com" | |
Action: | |
- "sts:AssumeRole" | |
PushPolicy: | |
Type: "AWS::IAM::Policy" | |
Properties: | |
PolicyName: "registry_push" | |
Roles: | |
- !Ref PushRole | |
PolicyDocument: | |
Version: "2012-10-17" | |
Statement: | |
- | |
Resource: !Join [ "", [ "arn:aws:ecr:", !Ref "AWS::Region", ":", !Ref "AWS::AccountId", ":repository/", !Ref Repository ] ] | |
Effect: "Allow" | |
Action: | |
- "ecr:BatchDeleteImage" | |
- "ecr:CompleteLayerUpload" | |
- "ecr:InitiateLayerUpload" | |
- "ecr:ListImages" | |
- "ecr:PutImage" | |
- "ecr:UploadLayerPart" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment