Skip to content

Instantly share code, notes, and snippets.

@labrute974
Created October 1, 2016 21:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save labrute974/034729ad1db74ed16dfdb01d507bbb2e to your computer and use it in GitHub Desktop.
Save labrute974/034729ad1db74ed16dfdb01d507bbb2e to your computer and use it in GitHub Desktop.
cloudformation_ecr_dependency
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"
Policies:
-
PolicyName: "ECRPush"
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"
@labrute974
Copy link
Author

this is an invalid CF stack. purposed for a blog post

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment