This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"AWSTemplateFormatVersion" : "2010-09-09", | |
"Description" : "AWS CloudFormation Template Route53_CNAME. This uses the patameters to create a subdomain CNAME", | |
"Parameters" : { | |
"HostedZone" : { | |
"Type" : "String", | |
"Description" : "The DNS name of an existing Amazon Route 53 hosted zone", | |
"AllowedPattern" : "(?!-)[a-zA-Z0-9-.]{1,63}(?<!-)", | |
"ConstraintDescription" : "must be a valid DNS zone name." | |
}, | |
"SubdomainParam": { | |
"Type": "String", | |
"Description": "Enter the subdomain name for the stack you want mapped to the CNAME" | |
}, | |
"LoadBalancerParam": { | |
"Type": "String", | |
"Description": "Enter the loadbalancer name for the stack you want mapped to the CNAME" | |
} | |
}, | |
"Resources" : { | |
"SubdomainDNSRecord" : { | |
"Type" : "AWS::Route53::RecordSet", | |
"Properties" : { | |
"HostedZoneName" : { "Fn::Join" : [ "", [{"Ref" : "HostedZone"}, "." ]]}, | |
"Comment" : "CNAME redirect to subdomain.", | |
"Name" : { "Fn::Join" : [ "", [{"Ref" : "SubdomainParam"}, ".", {"Ref" : "HostedZone"}, "."]]}, | |
"Type" : "CNAME", | |
"TTL" : "900", | |
"ResourceRecords" : [{ | |
"Ref": "LoadBalancerParam" | |
}] | |
} | |
} | |
}, | |
"Outputs" : { | |
"CNAME" : { | |
"Description" : "Fully qualified domain name", | |
"Value" : { "Ref" : "SubdomainDNSRecord" } | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
aws cloudformation create-stack --profile default --stack-name stage-blog-cname \ | |
--template-body file:///Users/claytongraham/data/github/dronze/dronze-cicd/cf/r53_cname.json \ | |
--parameters ParameterKey=HostedZone,ParameterValue=dronze.com \ | |
ParameterKey=SubdomainParam,ParameterValue=stage.blog \ | |
ParameterKey=LoadBalancerParam,ParameterValue=dronze-elb-PROD-1699664721.us-west-2.elb.amazonaws.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Action": "cloudformation:*", | |
"Effect": "Allow", | |
"Resource": "arn:aws:cloudformation:us-west-2:715212546939:stack/*" | |
}, | |
{ | |
"Action": "route53:*", | |
"Effect": "Allow", | |
"Resource": "arn:aws:route53:::hostedzone/Z3VRQF6A9GQX5I" | |
}, | |
{ | |
"Action": "codepipeline:*", | |
"Effect": "Allow", | |
"Resource": "*" | |
} | |
] | |
} |
No comments:
Post a Comment