mathewgries
10/09/2021, 4:01 PMmathewgries
10/09/2021, 4:13 PMmathewgries
10/09/2021, 4:51 PMmathewgries
10/09/2021, 5:11 PMhostedZone: HostedZone.fromHostedZoneAttributes(this, "MyZone" <-- This gusy
this.api = new sst.Api(this, “Api” <-- And this guy
Is this customizable, and how is it used behind the scenes. What should we be putting as a value here, and where doe it get used in the deployments?mathewgries
10/09/2021, 5:14 PMmathewgries
10/10/2021, 12:50 AMChad (cysense)
10/10/2021, 2:54 AM_this_.api = new sst.Api(_this_, "Api"
<- this guy is the logical ID for the resource. CDK uses this plus a random hash to uniquely identify resources. So if you modify the declaration here then CDK will know which resource to update in the cloud. You're right that CDK appends resources with logical id of its parents and it can be redundant depending on how you name it. We use names that describe what the resource is (without context) and then when CDK appends the parent resource's logical id you have a descriptive name. For example:
MyFirstStack
-> SharedInf
-> UsersTable
So the logical ID you will see in cloudformation will be something like: MyFirstStack/SharedInf/UsersTable
Now to answer your first question:
Can I point my prod build to use the hosted zone in my root account, or would I need to do the same set up in my prod Organization that I did in my dev AccountYou should do the same setup in prod that you did in dev account. You probably could point prod to root (I can imagine there is a way to do this) but this goes against best practice. Ideally, you should not have anything in your root account and use that for billing and then use your prod account for prod related resources. So doing what you did in dev is probably the easiest, most secure and most scalable approach. For the second question you could also do something like this:
route53.HostedZone.fromLookup(this, 'MyZone', { domainName: `www.${environment}.<http://mathewgries.com|mathewgries.com>` })
Frank
Frank
stage
you are deploying to. You can access the stage like this:
this.node.root.stage;
Or in TypeScript:
const app = scope.node.root as <http://sst.App|sst.App>;
app.stage
Frank
mathewgries
10/10/2021, 4:25 PMmathewgries
10/11/2021, 5:45 PM