-
Notifications
You must be signed in to change notification settings - Fork 2
/
quack-stanley-storage.template.yaml
58 lines (51 loc) · 1.45 KB
/
quack-stanley-storage.template.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
AWSTemplateFormatVersion: 2010-09-09
Description: Persistent resources for quack-stanley application
Parameters:
Stage:
Type: String
Default: prod
Resources:
AppDataBucket:
Type: AWS::S3::Bucket
Properties:
AccessControl: Private
BucketName: !Sub quack-stanley-data-${Stage}
LifecycleConfiguration:
Rules:
- ExpirationInDays: 7
Status: Enabled
Tags:
- Key: app
Value: quack-stanley
- Key: stage
Value: !Ref Stage
WebrootAccessIdentityID:
Type: AWS::CloudFront::CloudFrontOriginAccessIdentity
Properties:
CloudFrontOriginAccessIdentityConfig:
Comment: QuackStanley webroot CDN access
WebrootBucket:
Type: AWS::S3::Bucket
Properties:
BucketName: !Sub quack-stanley-www-${Stage}
Tags:
- Key: app
Value: quack-stanley
- Key: stage
Value: !Ref Stage
WebrootBucketPolicy:
Type: AWS::S3::BucketPolicy
Properties:
Bucket: !Ref WebrootBucket
PolicyDocument:
Statement:
- Effect: Allow
Action:
- s3:GetObject
Resource: !Sub arn:aws:s3:::${WebrootBucket}/*
Principal:
AWS: !Sub arn:aws:iam::cloudfront:user/CloudFront Origin Access Identity ${WebrootAccessIdentityID}
Outputs:
WebrootAccessIdentityID:
Description: ID of CloudFront origin access identity for webroot bucket access
Value: !Ref WebrootAccessIdentityID