…and a different question – Is there a smart way ...
# help
c
…and a different question – Is there a smart way to dynamically pass or reference an ARN between separate services (SST projects) in the same AWS account?
t
SSM!
I love ssm!
More specifically, create an SSM parameter with a key that looks something like this
Copy code
/<stagename>/<appname>/DYNAMO_TABLE = table.tableName
Then you can import that value from wherever you need it
c
System Manager, right? Cool, it looks like I have new thing to learn 😂 Thanks Dax
t
Another option is to add an output to the stack and then import it using
cdk.Fn.importValue
But I'm less familiar with that
here's a snippet from my codebase for creating ssm values
Copy code
import * as ssm from "@aws-cdk/aws-ssm"
public static ssm(stack: sst.Stack, name: string, value: string) {
    const app = stack.node.root as <http://sst.App|sst.App>
    new ssm.StringParameter(stack, "Param" + name, {
      parameterName: `/${stack.stage}/${app.name}/${name}`,
      stringValue: value,
    })
  }
c
Awesome, thanks. I’ll play with that
a
@thdxr love it. I’m also using SSM but to store other configs.
c
@thdxr follow-up question on this whenever you have time — in addition to options like SSM and
cdk.Fn.importValue
do you know if the values published from a stack via
.addOutputs
are available somehow to other services within the same AWS account?
t
cdk.Fn.importValue
I think reads those
And you can query the stack outputs from aws sdk if you need it elsewhere
c
Cool, I’ll try that, thanks