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 Antwort
1
Akzeptierte Antwort

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
EXPERTE
beantwortet vor 9 Monaten
profile picture
EXPERTE
überprüft vor 9 Monaten

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen