Forked from christianklotz/aws-template-bucket-custom-acl.yaml
Created
September 23, 2020 10:25
-
-
Save seahrh/f41c91e59516ca827cf689dc8765a154 to your computer and use it in GitHub Desktop.
CloudFormation template to create S3 bucket resource with custom role
This file contains hidden or 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 | |
Transform: AWS::Serverless-2016-10-31 | |
Parameters: | |
BucketPrefix: | |
Type: String | |
Description: "The prefix used for all S3 buckets." | |
AllowedPattern: "[a-z-]+" | |
Resources: | |
Assets: | |
Type: AWS::S3::Bucket | |
Properties: | |
BucketName: !Sub "${BucketPrefix}-assets" | |
CustomRole: | |
Type: "AWS::IAM::Role" | |
Properties: | |
RoleName: !Sub "${AWS::StackName}-CustomRole" | |
Path: / | |
AssumeRolePolicyDocument: | |
Version: 2012-10-17 | |
Statement: | |
- # add your own statement here | |
Policies: | |
- | |
PolicyName: !Sub "${AWS::StackName}-CustomRole" | |
PolicyDocument: | |
Statement: | |
- | |
Effect: Allow | |
Action: | |
- s3:PutObject | |
- s3:GetObject | |
- s3:PutObjectTagging | |
Resource: | |
- !Join ["", ["arn:aws:s3:::", Ref: "BucketPrefix", "-assets", "/*" ]] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment