Articles → AWS → Import And Export Data Between The Stacks In AWS CloudFormation
Import And Export Data Between The Stacks In AWS CloudFormation
Scenario
Stack Creation
{
"AWSTemplateFormatVersion": "2010-09-09",
"Metadata": {
"AWS::CloudFormation::Designer": {
"2dc4ba2f-ea15-4070-8c8e-4292600d411f": {
"size": {
"width": 60,
"height": 60
},
"position": {
"x": 523,
"y": 122
},
"z": 0
}
}
},
"Resources": {
"S3B33CKD": {
"Type": "AWS::S3::Bucket",
"Properties": {
"BucketName": "gs-sourcebucket"
},
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "2dc4ba2f-ea15-4070-8c8e-4292600d411f"
}
}
}
},
"Outputs": {
"bucketname1": {
"Description": "gs-source1bucket",
"Value": "gs-source1bucket",
"Export": {
"Name": "gyansangrahbucketname"
}
}
}
}
Click to Enlarge
{
"AWSTemplateFormatVersion": "2010-09-09",
"Metadata": {
"AWS::CloudFormation::Designer": {
"2dc4ba2f-ea15-4070-8c8e-4292600d411f": {
"size": {
"width": 60,
"height": 60
},
"position": {
"x": 523,
"y": 122
},
"z": 0
}
}
},
"Resources": {
"S3B33CKD": {
"Type": "AWS::S3::Bucket",
"Properties": {
"BucketName": { "Fn::ImportValue": "gyansangrahbucketname" }
},
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "2dc4ba2f-ea15-4070-8c8e-4292600d411f"
}
}
}
}
}
{ "Fn::ImportValue": "gyansangrahbucketname" }
Click to Enlarge
Output
Click to Enlarge