HTTPS: Add an HTTPS Endpoint

We'll cover the following...

Objective

  • Migrate our endpoint from HTTP to HTTPS.

Steps

  • Add an HTTPS endpoint.

Adding the HTTPS endpoint #

We will now update our deploy-infra.sh script to retrieve the certificate ARN. This should go at the top of the script, and depends on the DOMAIN environment variable.

Press + to interact
DOMAIN=the-good-parts.com
CERT=`aws acm list-certificates --region $REGION --profile awsbootstrap --output text \
--query "CertificateSummaryList[?DomainName=='$DOMAIN'].CertificateArn | [0]"`

Line #3: Newly added environment variable holding our certificate.

We then have to pass the certificate ARN as a parameter to main.yml.

Press + to interact
# Deploy the CloudFormation template
echo -e "\n\n=========== Deploying main.yml ==========="
aws cloudformation deploy \
--region $REGION \
--profile $CLI_PROFILE \
--stack-name $STACK_NAME \
--template-file ./cfn_output/main.yml \
--no-fail-on-empty-changeset \
--capabilities CAPABILITY_NAMED_IAM \
--parameter-overrides \
EC2InstanceType=$EC2_INSTANCE_TYPE \
Domain=$DOMAIN \
Certificate=$CERT \
GitHubOwner=$GH_OWNER \
GitHubRepo=$GH_REPO \
GitHubBranch=$GH_BRANCH \
GitHubPersonalAccessToken=$GH_ACCESS_TOKEN \
CodePipelineBucket=$CODEPIPELINE_BUCKET

Line #13: The certificate ARN.

We also have to add this as a parameter in the main.yml ... ...