Skip to content

Commit 6e1ccc9

Browse files
AWS Cloudformation Static Site S3 Host
1 parent 3d562c9 commit 6e1ccc9

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed
+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
AWSTemplateFormatVersion: 2010-09-09
2+
Parameters:
3+
S3BucketName:
4+
Type: String
5+
Default: testing.stackemblocks
6+
Description: Enter name for site's S3Bucket.
7+
Resources:
8+
S3Bucket:
9+
Type: AWS::S3::Bucket
10+
Properties:
11+
BucketName: !Ref S3BucketName
12+
AccessControl: PublicRead
13+
WebsiteConfiguration:
14+
IndexDocument: index.html
15+
ErrorDocument: error.html
16+
DeletionPolicy: Retain
17+
BucketPolicy:
18+
Type: AWS::S3::BucketPolicy
19+
Properties:
20+
PolicyDocument:
21+
Id: MyPolicy
22+
Version: 2012-10-17
23+
Statement:
24+
- Sid: PublicReadForGetBucketObjects
25+
Effect: Allow
26+
Principal: '*'
27+
Action: 's3:GetObject'
28+
Resource: !Join
29+
- ''
30+
- - 'arn:aws:s3:::'
31+
- !Ref S3Bucket
32+
- /*
33+
Bucket: !Ref S3Bucket
34+
Outputs:
35+
WebsiteURL:
36+
Value: !GetAtt
37+
- S3Bucket
38+
- WebsiteURL
39+
Description: URL for website hosted on S3
40+
S3BucketURL:
41+
Value: !Join
42+
- ''
43+
- - 'http://'
44+
- !GetAtt
45+
- S3Bucket
46+
- DomainName
47+
Description: Name of S3 bucket to hold website content

0 commit comments

Comments
 (0)