Dimitri van Hees
03/24/2022, 9:51 AMdev
and prod
stages both have their own AWS account. Now, if I want my dev domain to be <http://dev.domain.com|dev.domain.com>
and my prod domain to be <http://www.domain.com|www.domain.com>
, what would be the best approach?
From the guide:
Of course, you can change this if you’d like to use a custom domain for the other stages. You can use something likeShould I just register the domain in the. So for${scope.stage}.<http://my-serverless-app.com|my-serverless-app.com>
it’ll bedev
. But we’ll leave this as an exercise for you.<http://dev.my-serverless-app.com|dev.my-serverless-app.com>
prod
account and manually set the certificates for dev
?Rob N
03/24/2022, 10:11 AM<http://dev.domain.com|dev.domain.com>
to the account use use for dev, that way the DNS and certificate creation can be handled automatically without any intervention.
This should help you https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/CreatingNewSubdomain.htmlRob N
03/24/2022, 10:15 AM<http://dev.domain.com|dev.domain.com>
so your SST/CDK code will just work on the existing a-count you are on.Dimitri van Hees
03/24/2022, 10:17 AMRob N
03/24/2022, 10:35 AMDimitri van Hees
03/24/2022, 10:37 AMFrank
Frank
Frank
<http://domain.com|domain.com>
already exists in ur prod
account
2. Follow the tutorial to setup <http://dev.domain.com|dev.domain.com>
HostedZone in ur dev
account
3. In SST app, set up Api domain:
new Api(this, "api", {
customDomain: scope.stage === "prod"
? "<http://api.domain.com|api.domain.com>"
: `<http://api.dev.domain.com|api.dev.domain.com>`,
...
});
4. Setup StaticSite domain:
new StaticSite(this, "site", {
customDomain: scope.stage === "prod"
? "<http://www.domain.com|www.domain.com>"
: `<http://dev.domain.com|dev.domain.com>`,
...
});
Dimitri van Hees
03/24/2022, 2:23 PM