Skip to content

Instantly share code, notes, and snippets.

@davidfrey
Created February 21, 2017 15:27
Show Gist options
  • Save davidfrey/7e72a8671f328a394be2370fa203a8c0 to your computer and use it in GitHub Desktop.
Save davidfrey/7e72a8671f328a394be2370fa203a8c0 to your computer and use it in GitHub Desktop.
Cloud Formation: Keen Stream to S3
AWSTemplateFormatVersion: "2010-09-09"
Description: Keen Policy Test
Metadata:
AWS::CloudFormation::Interface:
ParameterGroups:
- Label:
default: Stack Variables
Parameters:
- Environment
- Label:
default: Constants
Parameters:
- AppName
Parameters:
AppName:
Type: String
Default: keen-policy
AllowedValues:
- keen-policy
Environment:
Type: String
AllowedValues:
- dev
- test
- prod
Default: dev
Resources:
KeenSourceBucket:
Type: AWS::S3::Bucket
Properties:
BucketName: !Join [ "-", [ !Ref AppName, !Ref Environment ] ]
KeenSourceBucketPolicy:
Type: AWS::S3::BucketPolicy
DependsOn:
- KeenSourceBucket
Properties:
Bucket: !Ref KeenSourceBucket
PolicyDocument:
Version: 2012-10-17
Statement:
- Sid: Objects
Effect: Allow
Principal:
CanonicalUser: ad6a62a1f25789760c5a581938a7ee06a865d0b95cc5b1b900d31170da42a48c
Action:
- s3:PutObject
- s3:GetObject
- s3:DeleteObject
Resource: !Join [ "", [ "arn:aws:s3:::", !Ref KeenSourceBucket, "/*" ] ]
- Sid: Bucket
Effect: Allow
Principal:
CanonicalUser: ad6a62a1f25789760c5a581938a7ee06a865d0b95cc5b1b900d31170da42a48c
Action:
- s3:ListBucket
Resource: !Join [ "", [ "arn:aws:s3:::", !Ref KeenSourceBucket ] ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment