I have nginx
configuration files which I would like to deploy on my Ubuntu
EC2
instance. I create instance using AWS CLI
:
aws ec2 run-instances --instance-type t2.micro \
--count 1 \
--image-id ami-0f8b8babb98cc66d0 \
--key-name "$key_name" \
--tag-specifications "ResourceType=instance,Tags=[{Key=Name,Value=$name}]" \
--query "Instances[0].{$instance_fields_selection}" \
--user-data 'file://ec2-setup'
This mostly works as expected: ec2-setup
script creates some folders, installs some packages and does reboot
. But I still have to upload my nginx
config files manually through scp
. --user-data
option seems to be intended for uploading files, but in fact it is used for passing initialization script. Is it possible to toss normal non-executable file on instance when creating it using AWS CLI
?