In the stack that creates the resources, export the name/arn values you need in your other stack(s):
Outputs:
ExampleS3BucketName:
Description: The Name of the Example S3 Bucket
Value:
Ref: S3BucketExample
Export:
Name: ${self:service}-${self:provider.stage}-ExampleS3BucketName
ExampleS3BucketArn:
Description: The Arn of the Example S3 Bucket
Value:
Fn::GetAtt: [ S3BucketExample, Arn ]
Export:
Name: ${self:service}:${self:provider.stage}:ExampleS3BucketArn
Then in the serverless.yml of the stacks that need the values, import via ${cf:…} or Fn::Import the properties you need. (arn to grant iamRolePermissions, name to access it.
Hey everyone, we are exploring solutions for these exact scenarios: deploying resources (e.g. database, SQS, S3…) separately from the serverless service/API, and easily integrate the ARNs/IDs of those resources.
We’re looking for users to give feedback on that feature (and possibly beta test it). If you are interested, post a reply here or send me an email: matthieu.napoli@serverless.com