I love using the AWS CDK and for my own project, I...
# help
k
I love using the AWS CDK and for my own project, I added in the concepts of stages so I can can have
dev
,
test
,
prod
and so on. I stumbled on serverless-stack and realised where SST was better than my own (hastily) home rolled solution and I've looked into porting. I have one question regarding the management of stages/deploying. In my current CDK project, I have multiple "apps" (that is
bin/*.ts
) to represent different logical areas of infrastructure. For example a "global" app for things like Hosted Zones, an "identity" app for different identity concerns, an "api" app for deploying my public facing API into multiple regions (I'm using Regional API Gateways with Route 53 latency policies). My CI/CD pipelines can then run each app as required into the correct regions/stages and it all works. However with SST there are no more "apps", just the
stacks/index.js
. I'm wondering how to port my CDK apps to the SST setup to maintain my existing separation of stacks into their logical areas.
f
Hey @kierans777, currently each SST app is one CDK app. You can create multiple SST apps to mirror the same setup.
Just curious does each of your CDK apps in
bin/*.ts
have multiple stacks in them?
k
@Frank Some do, depending on the relationships between the components.
You can create multiple SST apps to mirror the same setup.
Can I pass a different
index.js
file to the
sst deploy
command?
Or do I have to structure the layout differently?
Copy code
project1
  -> stacks/index.js

project2
  -> stacks/index.js

common
  -> constants.js
j
Hi, sorry to be dogmatic but I would normally choose to isolate the infrastructure into decoupled microservices. Each service should have its own deployment pipeline and github repository. It sounds like you have one big pipeline that needs to deploy multiple apps, which are composed of multiple stacks, which are composed of multiple constructs. This makes deployments slower, and dependencies a nightmare at scale. It is better to keep things tidy by making them separate repos with their own pipelines
(In my opinion)
k
@Joe Kendal I understand what you're saying. However there are other considerations I need to take into account.
Can I pass a different 
index.js
 file to the 
sst deploy
 command?
Reading the source code for the CLI, I believe the answer is no, because the way the CLI and
sst.json
work together.