https://serverless-stack.com/ logo
#help
Title
# help
c

Clayton

11/04/2021, 9:59 PM
…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

thdxr

11/04/2021, 10:00 PM
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

Clayton

11/04/2021, 10:02 PM
System Manager, right? Cool, it looks like I have new thing to learn 😂 Thanks Dax
t

thdxr

11/04/2021, 10:03 PM
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

Clayton

11/04/2021, 10:04 PM
Awesome, thanks. I’ll play with that
a

Adrián Mouly

11/04/2021, 10:32 PM
@thdxr love it. I’m also using SSM but to store other configs.
c

Clayton

11/05/2021, 2:53 PM
@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

thdxr

11/05/2021, 2:53 PM
cdk.Fn.importValue
I think reads those
And you can query the stack outputs from aws sdk if you need it elsewhere
c

Clayton

11/05/2021, 2:58 PM
Cool, I’ll try that, thanks