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 Risposta
1
Risposta accettata

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
ESPERTO
con risposta 9 mesi fa
profile picture
ESPERTO
verificato 9 mesi fa

Accesso non effettuato. Accedi per postare una risposta.

Una buona risposta soddisfa chiaramente la domanda, fornisce un feedback costruttivo e incoraggia la crescita professionale del richiedente.

Linee guida per rispondere alle domande