Jacob Hogenkamp
03/30/2022, 6:11 PMprovider:
environment:
myTableName: ${cf:myOtherService-${self:provider.stage}.TableName}
Then I dereference myTableName
from process.env
within the lambda.
What is the best way to do this within SST?Ross Coundon
03/30/2022, 6:12 PMJacob Hogenkamp
03/30/2022, 6:15 PMSeth Geoghegan
03/30/2022, 6:24 PM.env
files for each environment (stage/prod/etc) and list the ARNs there. You could then import based on the value in the environment variable. For example:
new Table(this, "Table", {
dynamodbTable:dynamodb.Table.fromTableArn(this, "ImportedTable", process.env.TableArn),
});
More info here.
2. Save the ARNs to a shared environment like AWS Parameter Store with names that are defined by stage. For example, you could have parameters named /prod/my_service/table_arn
, /stage/my_service/table_arn
Jacob Hogenkamp
03/30/2022, 6:31 PMSeth Geoghegan
03/30/2022, 6:33 PM