Skip to content

Instantly share code, notes, and snippets.

@akira345
Created February 7, 2016 07:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save akira345/941225dfc87eed272754 to your computer and use it in GitHub Desktop.
Save akira345/941225dfc87eed272754 to your computer and use it in GitHub Desktop.
S3+CloudFront構成をCloufFormerでJSON化したもの
{
"AWSTemplateFormatVersion": "2010-09-09",
"Resources": {
"distd1gtempk1i1houcloudfrontnet": {
"Type": "AWS::CloudFront::Distribution",
"Properties": {
"DistributionConfig": {
"Comment": "commnent string",
"DefaultRootObject": "index.html",
"PriceClass": "PriceClass_200",
"DefaultCacheBehavior": {
"TargetOriginId": "S3-hogehogehugahuga",
"ViewerProtocolPolicy": "allow-all",
"MinTTL": 0,
"AllowedMethods": [
"HEAD",
"GET"
],
"CachedMethods": [
"HEAD",
"GET"
],
"ForwardedValues": {
"Cookies": {
"Forward": "none"
}
}
},
"Origins": [
{
"DomainName": "hogehogehugahuga.s3.amazonaws.com",
"Id": "S3-hogehogehugahuga",
"S3OriginConfig": {
"OriginAccessIdentity": "origin-access-identity/cloudfront/E9BLJQMFHALRD"
}
}
],
"Restrictions": {
"GeoRestriction": {
"RestrictionType": "none",
"Locations": [
]
}
},
"ViewerCertificate": {
"CloudFrontDefaultCertificate": "true",
"MinimumProtocolVersion": "SSLv3"
}
}
}
},
"s3hogehogehugahuga": {
"Type": "AWS::S3::Bucket",
"Properties": {
"AccessControl": "Private",
"VersioningConfiguration": {
"Status": "Suspended"
}
}
},
"s3policyhogehogehugahuga": {
"Type": "AWS::S3::BucketPolicy",
"Properties": {
"Bucket": {
"Ref": "s3hogehogehugahuga"
},
"PolicyDocument": {
"Version": "2008-10-17",
"Id": "PolicyForCloudFrontPrivateContent",
"Statement": [
{
"Sid": "1",
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::cloudfront:user/CloudFront Origin Access Identity E9BLJQMFHALRD"
},
"Action": "s3:GetObject",
"Resource": {
"Fn::Join": [
"",
[
"arn:aws:s3:::",
{
"Ref": "s3hogehogehugahuga"
},
"/*"
]
]
}
}
]
}
}
}
},
"Description": "test"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment