-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathmyTemplate.yaml
More file actions
87 lines (86 loc) · 2.52 KB
/
myTemplate.yaml
File metadata and controls
87 lines (86 loc) · 2.52 KB
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
AWSTemplateFormatVersion: 2010-09-09
Resources:
myDistribution:
Type: 'AWS::CloudFront::Distribution'
Properties:
DistributionConfig:
Origins:
- DomainName: mys3bucket-example.s3.amazonaws.com
Id: S3Origin
S3OriginConfig:
OriginAccessIdentity: ''
Enabled: 'true'
DefaultRootObject: index.html
Logging:
IncludeCookies: 'false'
Bucket: mys3logbucket-example.s3.amazonaws.com
Prefix: myprefix
DefaultCacheBehavior:
AllowedMethods:
- GET
- HEAD
TargetOriginId: S3Origin
ForwardedValues:
QueryString: 'false'
Cookies:
Forward: none
ViewerProtocolPolicy: allow-all
PriceClass: PriceClass_100
ViewerCertificate:
CloudFrontDefaultCertificate: 'true'
DependsOn:
- MyStaticSiteBucket
- MyLogBucket
MyStaticSiteBucket:
Type: 'AWS::S3::Bucket'
Properties:
BucketName: mys3bucket-example
WebsiteConfiguration:
IndexDocument: index.html
MyLogBucket:
Type: 'AWS::S3::Bucket'
Properties:
BucketName: mys3logbucket-example
DependsOn:
- MyStaticSiteBucket
MyStaticSiteBucketPolicy:
Type: 'AWS::S3::BucketPolicy'
Properties:
Bucket: !Ref MyStaticSiteBucket
PolicyDocument:
Statement:
- Sid: ReadAccess
Action:
- "s3:GetObject"
Effect: "Allow"
Resource: 'arn:aws:s3:::mys3bucket-example/*'
Principal: "*"
- Sid: ListWriteDeleteAccess
Action:
- "s3:ListBucket"
- "s3:PutObject"
- "s3:DeleteObject"
Effect: "Allow"
Resource:
- 'arn:aws:s3:::mys3bucket-example/*'
- 'arn:aws:s3:::mys3bucket-example'
Principal:
AWS: 'arn:aws:iam::example:user/myuser'
MyLogBucketPolicy:
Type: 'AWS::S3::BucketPolicy'
Properties:
Bucket: !Ref MyLogBucket
PolicyDocument:
Statement:
- Sid: ListReadWriteDeleteAccess
Action:
- "s3:ListBucket"
- "s3:GetObject"
- "s3:PutObject"
- "s3:DeleteObject"
Effect: "Allow"
Resource:
- 'arn:aws:s3:::mys3logbucket-example/*'
- 'arn:aws:s3:::mys3logbucket-example'
Principal:
AWS: 'arn:aws:iam::example:user/myuser'