I am working on an existing project, built with se...
# help
p
I am working on an existing project, built with serverless and manual deployment. Here, I want to create
Congnito
instance using
Auth
. But for the production stage
cognito
instance has already been created manually. What is the best way to create
Auth
instance such that, in other
stage
, sst manages creation of
cognito
but in production stage it uses existing
cognito
instance. Even better if there is a way to include existing
cognito
as if it was created using SST, so that infra code is uniform across all the stages.
j
Conditionally-creating resources within a stack, although not the best approach, can be achieve using
app.stage
and or
app.IS_LOCAL
. Another approach is to extract stateful resources, like your Cognito pool, into another stack. In this case, you would either (1) conditionally-create the stack using the same technique as before or (2) use SSM or env vars to shared information across stacks, like pool IDs and such.
p
I found the blog which is more closer to what I am expecting. Let me try that. https://aws.amazon.com/blogs/aws/new-import-existing-resources-into-a-cloudformation-stack/
Looks like
congnito
is not supported for importing existing resource