alert-raincoat-81485
02/08/2021, 9:35 PMuser_data = """
#!/bin/bash
set -eux
sudo aws s3 cp s3://<bucket-name>/<script>.sh /tmp/
"""
Instances = aws.ec2.Instance(
instance_name,
ami=ami,
instance_type=size,
subnet_id=subnets[1],
user_data_base64=user_data,
security_groups=[securitygroup]
)
If anyone can help to review!little-cartoon-10569
02/08/2021, 9:37 PMuser_data
parameter.alert-raincoat-81485
02/08/2021, 9:40 PMuser_data
parameter as well, but it’s the same thinglittle-cartoon-10569
02/08/2021, 9:41 PMalert-raincoat-81485
02/08/2021, 9:44 PMbillowy-army-68599
02/08/2021, 9:45 PMuser_data
stringalert-raincoat-81485
02/08/2021, 9:45 PMlittle-cartoon-10569
02/08/2021, 9:46 PMalert-raincoat-81485
02/09/2021, 1:40 AMuser_data = """
#!/bin/bash
echo "Hello, World!" > index.html
nohup python -m SimpleHTTPServer 80 &
"""
it appears on metadata curl but it doesn’t run anything.little-cartoon-10569
02/09/2021, 1:41 AMalert-raincoat-81485
02/09/2021, 1:43 AMfind
but seems to be nowhere.little-cartoon-10569
02/09/2021, 1:44 AMalert-raincoat-81485
02/09/2021, 1:44 AMlittle-cartoon-10569
02/09/2021, 1:44 AMfind
to find it, it's not stored locally. It's magically "beside" your machine.alert-raincoat-81485
02/09/2021, 1:45 AMlittle-cartoon-10569
02/09/2021, 1:45 AM/bin/bash
from the command line?alert-raincoat-81485
02/09/2021, 1:46 AMuser_data = """
#!/bin/bash
set -eux
sudo aws s3 cp s3://<bucket-name>/<script>.sh /tmp/
"""
it’s appearing nowhere.little-cartoon-10569
02/09/2021, 1:46 AMcurl
from the instance, right?alert-raincoat-81485
02/09/2021, 1:47 AMindex.html
however i am seeing it using curl metadata but can’t see index.htmml
being created anywhere.
user_data = """
#!/bin/bash
echo "Hello, World!" > index.html
nohup python -m SimpleHTTPServer 80 &
"""
little-cartoon-10569
02/09/2021, 1:47 AM/bin/bash
is failing to run./bin/bash
. Have you checked that you can invoke /bin/bash
?alert-raincoat-81485
02/09/2021, 1:48 AMlittle-cartoon-10569
02/09/2021, 1:48 AMalert-raincoat-81485
02/09/2021, 1:49 AMlittle-cartoon-10569
02/09/2021, 1:50 AMalert-raincoat-81485
02/09/2021, 1:52 AMproud-art-41399
02/09/2021, 6:42 AMuser_data
like this:
user_data = """
...
"""
it leaves a leading new line which for some reason doesn't work with Ubuntu (at least 20.04). It works with Amazon Linux, though. I had to remove the empty new line by writing the user_data
like:
user_data = """\
...
"""
(note the trailing \
backslash).alert-raincoat-81485
03/05/2021, 7:50 PM