Tisha
Tisha

Reputation: 91

Cross stack-reference from different AWS accounts

I have two stacks - A & B, but they are in different AWS accounts. I want to export a resource(log) of stack A to stack B. Since it is cross-account, the normal stack referencing method won't work. I am trying to figure out the best way to do this.

If anyone has worked on this before, please do share how you implemented it.

Upvotes: 6

Views: 4790

Answers (1)

Marcin
Marcin

Reputation: 238051

Cross-account and cross-region export/imports are not supported in CloudFormation. If you want to have everything done automatically, you would have to develop a custom resource in stack B in the form of a lambda function. The function would have to be able to access and query the stack in A in different account, and return desired attributes to stack B.

Alternatively, you could store the attributes from stack A in a parameter store created in Acc B and use dynamic references in stack B to fetch the values from the store.

Other option is to parametrize stack B, and "manually" (could be through AWS CLI or SDK script) pass required attributes from stack A as parameters into the stack B.

Upvotes: 5

Related Questions