Domain: Custom Region infrastructure
On the AWS provider: the ACM certificate for CloudFront is always created in us-east-1, regardless of your stack Region. This is a CloudFront requirement — the certificate and the CDN alias must live in us-east-1 for the Route 53 A record to work.
In v3 this is no longer a limitation: even when your stack deploys to another region such as eu-central-1 (Central Europe), Gothic can manage the certificate for you automatically, placing it in us-east-1 on your behalf. You no longer have to hand-create the certificate in the AWS console.
You only set CertificateArn (an EnvValue, e.g. gothic.SSMParam(...)) when you want to reuse an existing us-east-1 certificate instead of having Gothic create one.
Here's an example. First change your Region in your gothic.config.go, then set CustomDomain and HostedZoneId on the stage. To reuse a certificate, add its ARN to SSM and reference it with CertificateArn as shown below.
Providers: gothic.Providers{
AWS: gothic.AWSProvider{
Region: "eu-central-1",
Stages: map[string]gothic.Stage{
"dev": {
CustomDomain: gothic.Env("dev.mycustomdomain.com"),
HostedZoneId: gothic.SSMParam("/gothic-cli/dev/hostedZoneId"),
CertificateArn: gothic.SSMParam("/gothic-cli/dev/certificateArn"),
},
},
},
},Did you like this session for deploy your domain with a custom region? Check out how to deploy your app with custom environment variables per stage!
