sparse-intern-71089
09/21/2018, 5:56 PMbright-motherboard-93404
09/21/2018, 5:57 PMgroup = ec2.SecurityGroup('web-secgrp',
description='Enable HTTP access',
ingress=[
{ 'protocol': 'tcp', 'from_port': 22, 'to_port': 22, 'cidr_blocks': ['0.0.0.0/0'] },
{ 'protocol': 'tcp', 'from_port': 8888, 'to_port': 8888, 'cidr_blocks': ['0.0.0.0/0'] }
])
user_data = """
#!/bin/bash
echo "Hello, World!" > index.html
nohup python -m SimpleHTTPServer 8888 &
"""
server = ec2.Instance('web-server-www',
instance_type=instance_type,
key_name=key_pair.key_name,
security_groups=[group.name],
user_data=user_data,
ami=ami)
bright-motherboard-93404
09/21/2018, 5:57 PMkey_pair
is a local .pem key that I use to be able to log inmicroscopic-florist-22719
incalculable-sundown-82514
09/21/2018, 6:00 PM/var/log/cloud-init-output.log
on your VM? If the user_data script ran, there should be some logs there.incalculable-sundown-82514
09/21/2018, 6:01 PMbright-motherboard-93404
09/21/2018, 6:01 PMincalculable-sundown-82514
09/21/2018, 6:01 PMbright-motherboard-93404
09/21/2018, 6:01 PMbright-motherboard-93404
09/21/2018, 6:01 PMbright-motherboard-93404
09/21/2018, 6:03 PMbright-motherboard-93404
09/21/2018, 6:03 PMCloud-init v. 18.3-9-g2e62cb8a-0ubuntu1~16.04.2 running 'modules:final' at Fri, 21 Sep 2018 18:01:08 +0000. Up 14.37 seconds.
2018-09-21 18:01:09,080 - util.py[WARNING]: Failed running /var/lib/cloud/instance/scripts/part-001 [-]
2018-09-21 18:01:09,088 - cc_scripts_user.py[WARNING]: Failed to run module scripts-user (scripts in /var/lib/cloud/instance/scripts)
2018-09-21 18:01:09,088 - util.py[WARNING]: Running module scripts-user (<module 'cloudinit.config.cc_scripts_user' from '/usr/lib/python3/dist-packages/cloudinit/config/cc_scripts_user.py'>) failed
Cloud-init v. 18.3-9-g2e62cb8a-0ubuntu1~16.04.2 finished at Fri, 21 Sep 2018 18:01:09 +0000. Datasource DataSourceEc2Local. Up 14.49 seconds
bright-motherboard-93404
09/21/2018, 6:19 PMincalculable-sundown-82514
09/21/2018, 6:20 PMincalculable-sundown-82514
09/21/2018, 6:21 PMbright-motherboard-93404
09/21/2018, 6:21 PMbright-motherboard-93404
09/21/2018, 6:21 PMincalculable-sundown-82514
09/21/2018, 6:22 PM/var/lib/cloud/instance/scripts/scripts-user
?incalculable-sundown-82514
09/21/2018, 6:22 PMbright-motherboard-93404
09/21/2018, 6:23 PM2018-09-21 18:01:09,088 - util.py[WARNING]: Running module scripts-user (<module 'cloudinit.config.cc_scripts_user' from '/usr/lib/python3/dist-packages/cloudinit/config/cc_scripts_user.py'>) failed
2018-09-21 18:01:09,088 - util.py[DEBUG]: Running module scripts-user (<module 'cloudinit.config.cc_scripts_user' from '/usr/lib/python3/dist-packages/cloudinit/config/cc_scripts_user.py'>) failed
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/cloudinit/stages.py", line 806, in _run_modules
freq=freq)
File "/usr/lib/python3/dist-packages/cloudinit/cloud.py", line 54, in run
return self._runners.run(name, functor, args, freq, clear_on_fail)
File "/usr/lib/python3/dist-packages/cloudinit/helpers.py", line 188, in run
return (True, results)
File "/usr/lib/python3.5/contextlib.py", line 77, in __exit__
self.gen.throw(type, value, traceback)
File "/usr/lib/python3/dist-packages/cloudinit/helpers.py", line 76, in lock
yield self._acquire(name, freq)
File "/usr/lib/python3/dist-packages/cloudinit/helpers.py", line 187, in run
results = functor(*args)
File "/usr/lib/python3/dist-packages/cloudinit/config/cc_scripts_user.py", line 45, in handle
util.runparts(runparts_path)
File "/usr/lib/python3/dist-packages/cloudinit/util.py", line 850, in runparts
% (len(failed), len(attempted)))
bright-motherboard-93404
09/21/2018, 6:23 PMcloud-init.log
bright-motherboard-93404
09/21/2018, 6:23 PMroot@ip-172-31-41-50:~# cat /var/lib/cloud/instance/scripts/scripts-user
cat: /var/lib/cloud/instance/scripts/scripts-user: No such file or directory
incalculable-sundown-82514
09/21/2018, 6:23 PMincalculable-sundown-82514
09/21/2018, 6:24 PMpulumi stack export
on your stack and look for a json field named “user_data”?incalculable-sundown-82514
09/21/2018, 6:25 PMbright-motherboard-93404
09/21/2018, 6:28 PMuser_data
?incalculable-sundown-82514
09/21/2018, 6:29 PMincalculable-sundown-82514
09/21/2018, 6:29 PMincalculable-sundown-82514
09/21/2018, 6:29 PMpulumi stack export
basically dumps the entire state of your stackbright-motherboard-93404
09/21/2018, 6:29 PM"userData": "\n#!/bin/bash\necho \"Hello, World!\" \u003e index.html\nnohup python -m SimpleHTTPServer 8888 \u003e /tmp/server 2\u003e\u00261 \u0026\nsleep 60\n"
bright-motherboard-93404
09/21/2018, 6:29 PMincalculable-sundown-82514
09/21/2018, 6:29 PMincalculable-sundown-82514
09/21/2018, 6:30 PMincalculable-sundown-82514
09/21/2018, 6:31 PMbright-motherboard-93404
09/21/2018, 6:31 PMbright-motherboard-93404
09/21/2018, 6:31 PMbright-motherboard-93404
09/21/2018, 6:31 PMbright-motherboard-93404
09/21/2018, 6:31 PMincalculable-sundown-82514
09/21/2018, 6:32 PMincalculable-sundown-82514
09/21/2018, 6:32 PMincalculable-sundown-82514
09/21/2018, 6:33 PMbright-motherboard-93404
09/21/2018, 6:33 PMbright-motherboard-93404
09/21/2018, 6:36 PMbright-motherboard-93404
09/21/2018, 6:36 PMincalculable-sundown-82514
09/21/2018, 6:36 PMincalculable-sundown-82514
09/21/2018, 6:36 PMbright-motherboard-93404
09/21/2018, 6:36 PMincalculable-sundown-82514
09/21/2018, 6:39 PMbright-motherboard-93404
09/21/2018, 6:42 PMbright-motherboard-93404
09/21/2018, 6:42 PMincalculable-sundown-82514
09/21/2018, 6:45 PMbright-motherboard-93404
09/21/2018, 6:46 PMincalculable-sundown-82514
09/21/2018, 6:50 PM"userData": "\n#!/bin/bash\necho \"Hello, World!\" > index.html\nnohup python -m SimpleHTTPServer 80 &\n"
incalculable-sundown-82514
09/21/2018, 6:50 PMincalculable-sundown-82514
09/21/2018, 6:50 PMincalculable-sundown-82514
09/21/2018, 6:50 PMbright-motherboard-93404
09/21/2018, 6:52 PMbright-motherboard-93404
09/21/2018, 6:53 PMincalculable-sundown-82514
09/21/2018, 6:53 PMbright-motherboard-93404
09/21/2018, 6:54 PMincalculable-sundown-82514
09/21/2018, 6:55 PMbright-motherboard-93404
09/21/2018, 6:57 PMbright-motherboard-93404
09/21/2018, 7:06 PMincalculable-sundown-82514
09/21/2018, 7:07 PMbright-motherboard-93404
09/21/2018, 7:14 PMbright-motherboard-93404
09/21/2018, 7:14 PMbright-motherboard-93404
09/21/2018, 7:14 PMincalculable-sundown-82514
09/21/2018, 7:15 PMbright-motherboard-93404
09/21/2018, 7:15 PMbright-motherboard-93404
09/21/2018, 7:36 PM2018-09-21 19:20:37,586 - __init__.py[WARNING]: Unhandled non-multipart (text/x-not-multipart) userdata: 'b'echo ok > ok'...'
incalculable-sundown-82514
09/21/2018, 7:39 PMbright-motherboard-93404
09/21/2018, 7:42 PMbright-motherboard-93404
09/21/2018, 7:42 PMincalculable-sundown-82514
09/21/2018, 8:43 PMtext/plain