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
1개 답변
1
수락된 답변

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
전문가
답변함 9달 전
profile picture
전문가
검토됨 9달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠