Dependencies Between Nested Stack [Stack 2 depend on Exported value from Stack 1]

0

How do i resolve depenecies form stack 1 in stack 2 Nested Stack Based on Imported Value form Stack 1

# Stack 1: Create S3 bucket and export its name
Resources:
  MyBucket:
    Type: AWS::S3::Bucket
    ...
  ExportBucketName:
    Value: !Ref MyBucket
    Export:
      Name: MyBucketName

# Stack 2: Create EC2 instance and reference S3 bucket
Resources:
  MyInstance:
    Type: AWS::EC2::Instance
    DependsOn: [Make it dependen on the exported value from stack 1 ExportBucketName]
    Properties:
      ...
      S3BucketName: !ImportValue MyBucketName
Nafiu
feita há 9 meses214 visualizações
1 Resposta
1
Resposta aceita

Hi,

Look at this page: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/walkthrough-crossstackref.html

You have working examples with corresponding CFN templates in steps 1 & 2 to understand fully how you cross-reference between stacks.

Best,

Didier

profile pictureAWS
ESPECIALISTA
respondido há 9 meses
profile picture
ESPECIALISTA
avaliado há 9 meses

Você não está conectado. Fazer login para postar uma resposta.

Uma boa resposta responde claramente à pergunta, dá feedback construtivo e incentiva o crescimento profissional de quem perguntou.

Diretrizes para responder a perguntas