forked from Chiango2/architecting-security-aws
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cli-commands.sh
23 lines (17 loc) · 822 Bytes
/
cli-commands.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# Load named profile
export AWS_PROFILE=ben
# Create S3 bucket
aws s3api create-bucket --bucket benpiper.com-cloudfront
# Create and uplaod index.html document
echo "Hello, world!" > index.html
aws s3 cp index.html s3://waer.com-cloudfront/
# Create the origin access identity (OAI)
aws cloudfront create-cloud-front-origin-access-identity \
--cloud-front-origin-access-identity-config \
CallerReference="demo",Comment="OAI for benpiper.com-cloudfront"
# Apply a bucket policy granting read access to the OAI
aws s3api put-bucket-policy --bucket benpiper.com-cloudfront --policy file://bucketpolicy.json
# Verify bucket policy
aws s3api get-bucket-policy --bucket benpiper.com-cloudfront
# Create a CloudFront distribution
aws cloudfront create-distribution --distribution-config file://dist-config.json