nvm install node
The domains need to be hosted in Route53. Cloudformation will automatically create the relevant Aliases.
You need to define 3 domains. One for each service. To make it easier, it is recommended to use sub-domains. But you don’t have too.
Retrieve the HostedZoneId for each domain. You will need to paste it into the configuration files of each service.
HOSTEDZONEID=$(aws --profile myprofile route53 list-hosted-zones --query 'HostedZones[?Name==`example.com.`].Id' --output text | cut -d'/' -f3)
ACM Certificates for Cloudfront need to be generated in us-east-1. And since Cloudformation isn’t able to easily do cross region stacks, we will create the certificates manually and only give their ARN as reference to our stacks.
Open ACM in us-east-1, generate a single certificate for gallery.example.com as primary domain and *.gallery.example.com as alternate domain. Use DNS as validation method, click the button to create the entries in Route53.
Keep the ARN (arn:aws:acm:us-east-1:AccountId:certificate/certificateId) somewhere.
Wait for the certificate to be valid.
If you haven’t already setup Amplify:
npm install -g @aws-amplify/cli amplify configure
The services don’t need to be in the same region. But it is highly recommended, mainly for imageResize and publicsite to be in the same region.