Hello guys, I am trying to wrap my head around usi...
# help
r
Hello guys, I am trying to wrap my head around using SSM in order to inject Cognito pool environment variables into the Next.js construct. Is there a complete example for this? I see https://serverless-stack.slack.com/archives/C01JG3B20RY/p1634575874311200?thread_ts=1633529817.256700&cid=C01JG3B20RY but points 2 & 3 I do not quite understand ( I’ll go dig more into SSM construct examples as well ). I am not super experienced using SST nor CDK but I have a working CDK version (creating a cognito user /identity pools and setting IAM permissions) but I was wondering: If I try to mix my CDK stack with SST, will I be able to reference the variables ( e.g.
UserPool.userPoolId
from
@aws-cdk/aws-cognito)
at build time? The CDK code I have right now only works because I am deploying the next.js site separately from the cdk backend, using the outputs json file generated from the outputs flag. P.D. Thanks to the SST team for the wonderful tool! I really think SST is the way!
f
Hey @Roberto Novelo, thanks for the kind words!
I just put together a sample repo here https://github.com/fwang/sst-load-ssm
1. It creates an
AuthStack
with a Cognito user pool and an SSM param with the user pool id 2. It then fetches the SSM value for the user pool id 3. It then creates a
WebStack
, currently just
console.log
the user pool id
Note that on when building for the first time (the SSM hasn’t been deployed in the
AuthStack
), the user pool id defaults to
placeholder
Let me know if this makes sense
r
Wow, thanks a lot! Just what I needed 🙏