Something went wrong on our end
Forked from
Språksamlingane / beta.ordbok.uib.no
2228 commits behind the upstream repository.
-
Ole Voldsæter authoredOle Voldsæter authored
beta.ordbok.uib.no_stack.yaml 4.01 KiB
AWSTemplateFormatVersion: '2010-09-09'
Description: >
Script to create S3 bucket, DNS (Route53) and Cloudfront distribution.
###############################################################################
Parameters:
###############################################################################
DomainName:
Type: String
Description: The domain name.
Default: 'beta.ordbok.aws.uib.no'
AllowedPattern: (?!-)[a-zA-Z0-9-.]{1,63}(?<!-)
ConstraintDescription: must be a valid DNS zone name
PriceClass:
Type: String
Description: The CloudFront distribution price class
Default: 'PriceClass_100'
AllowedValues:
- 'PriceClass_100'
#- 'PriceClass_200'
#- 'PriceClass_All'
CertificateArn:
Type: String
Default: ''
###############################################################################
Resources:
###############################################################################
DNS:
Type: "AWS::Route53::RecordSet"
Properties:
HostedZoneName: !Sub "${DomainName}."
Name: !Ref DomainName
Type: A
AliasTarget:
HostedZoneId: Z2FDTNDATAQYW2
DNSName: !GetAtt Distribution.DomainName
WebBucket:
Type: "AWS::S3::Bucket"
Properties:
BucketName: !Sub "${AWS::StackName}.aws.uib.no"
VersioningConfiguration:
Status: Enabled
Tags:
- Key: Application
Value: !Ref DomainName
BucketPolicy:
Type: "AWS::S3::BucketPolicy"
Properties:
Bucket: !Ref WebBucket
PolicyDocument:
Id: MyPolicy
Version: 2012-10-17
Statement:
- Sid: PublicReadForGetBucketObjects
Effect: Allow
Action: s3:*
Resource: !Join ['', ['arn:aws:s3:::', !Ref 'WebBucket', /*]]
Principal:
CanonicalUser: !GetAtt CloudFrontOriginIdentity.S3CanonicalUserId