Nikolas Ioannou
09/20/2021, 1:29 AMOmi Chowdhury
09/20/2021, 2:26 AMNikolas Ioannou
09/20/2021, 2:31 AMOmi Chowdhury
09/20/2021, 2:37 AMNikolas Ioannou
09/20/2021, 2:40 AMOmi Chowdhury
09/20/2021, 2:40 AMOmi Chowdhury
09/20/2021, 2:40 AMOmi Chowdhury
09/20/2021, 2:41 AMNikolas Ioannou
09/20/2021, 2:42 AMOmi Chowdhury
09/20/2021, 2:44 AMNikolas Ioannou
09/20/2021, 2:45 AMimport boto3
cf_client = boto3.client('cloudformation')
cf_client.create_stack(
StackName='your-stack',
TemplateURL='<https://s3.amazonaws.com/your-bucket/your-template>'
)
Do you think something like this could work?Omi Chowdhury
09/20/2021, 2:49 AMsst build
reading the template from the .build folder and seeing if it deploys. But like the deploy option above, you’d have to figure out how to call it programmatically, if you’re doing that, you may as well let let SST/CDK handle the deployment too instead of just the buildNikolas Ioannou
09/20/2021, 2:52 AMOmi Chowdhury
09/20/2021, 2:54 AMOmi Chowdhury
09/20/2021, 2:54 AMNikolas Ioannou
09/20/2021, 2:55 AMthdxr
09/20/2021, 3:08 AMNikolas Ioannou
09/20/2021, 3:09 AMFrank
lib/index.js
looked like this:
new StaticSiteStack(this, "site1");
new StaticSiteStack(this, "site2");
...
new StaticSiteStack(this, "site50");
and ur Lambda adds a new stack to the app and commits it?Dan Van Brunt
09/20/2021, 1:06 PMNikolas Ioannou
09/20/2021, 3:32 PMnew StaticSiteStack(this, "siteXX");
to index.js
and committing that? I didn't do a great job indicating the specifics but I feel like this would get messy if this grew to hundreds of sites.thdxr
09/20/2021, 3:33 PMsst build
to generate the CF template that can be usedthdxr
09/20/2021, 3:33 PMNikolas Ioannou
09/20/2021, 3:35 PMsst build
to get the template for my "defacto CFN template" which I can pass in params to. Host this template in S3 and then use the SDK's createStack
to create a number of those on command?thdxr
09/20/2021, 3:35 PMNikolas Ioannou
09/20/2021, 3:37 PMthdxr
09/20/2021, 3:37 PMthdxr
09/20/2021, 3:39 PMexport default async function main(app: <http://sst.App|sst.App>): void {
const sites = fetch_from_api()
// loop through sites and initiate one stack per site
}
The downside of this is you need to retrigger a CI build whenever a user adds a new site
Another approach is:
In your application define a stack, write it to file, and call sst deploy
dynamically on it. Right now there isn't an easier path to programmatically call sstthdxr
09/20/2021, 3:41 PM