Axel Ménage
Axel Ménage

Reputation: 1

How to do cross-application with serverless AWS

I have two different applications in AWS, deployed by two serverless config files. In the first one, I need to read the data from the DynamoDB of the second one.

serverless.yml n°1 :

service:
  name: stack1
app: app1
org: globalorg

serverless.yml n°2 :

service:
  name: stack2
app: app2
org: globalorg

If I put the 2 services in same app, I can access to the 2nd one with a line like this in iamRoleStatements :

Resource:
    - ${output::${param:env}::stack2.TableArn}

But if they are not in the same app, I have "Service not found" error when I try to deploy. How can I do this cross-application communication ? Thanks

Upvotes: 0

Views: 30

Answers (1)

AnonymousAlias
AnonymousAlias

Reputation: 1399

You will need to provide the actual ARN of the table now that this stack is not part of your app you cannot reference its components. Try something like this

custom:
  table: 
    tableArn: "<insert-ARN-of-resource-here>"
IamRoleStatements:
      Resource: ${self:custom.table.tableArn}

Upvotes: 2

Related Questions