I am having cloudformation template which contains two instances with userdata property.
I need to fetch the data from one instance's userdata and pass to another instances userdata.
For example(from below), need to fetch "test" from instance1, and pass to instance2 userdata.
Sample Template:
"instance1": {
"Type": "AWS::EC2::Instance",
"Properties": {
"UserData": {
"Fn::Base64": {
"Fn::Join": [
"",
[
"#!/bin/bash\n",
"set -x\n",
"echo test\n",
]]}}}},
"instance2": {
"Type": "AWS::EC2::Instance",
"Properties": {
"UserData": {
"Fn::Base64": {
"Fn::Join": [
"",
[
"#!/bin/bash\n",
"set -x\n",
//fetch the value
]]}}}},