I have a small confusion regarding the userdata that can be made available to an AWS machine during instance creation. So I have a bash script where I am generating a file as follows:
#!/bin/bash
echo "Creating a file" >> /files/test.txt
export MY_VARIABLE=/files/test.txt
Now I pass this script as the userdata variable when using the boto3 ec2 instance creation as:
import boto3
ec2 = s.resource('ec2')
with open('script.sh', r) as file:
user_data = file.read()
res = ec2.create_instances(... UserData=user_data)
Am I correct in assuming that the file and the environment variable created through the script will be available to the created instance?