AWS Opworks Instances not starting when created fr

2019-06-08 20:34发布

问题:

According to AWS documentation you can create a Custom AMI two different ways.

http://docs.aws.amazon.com/opsworks/latest/userguide/workinginstances-custom-ami.html

I'm creating my AMI directly from an EC2 instance so the OPworks Agent should NOT be there. Nevertheless instances created with my AMI would NOT get pass the setup stage.

Does anyone knows why this is?

Update:

Here's some more information. If you look at the article above it says to stop the OPworks agent etc. Well I logged into an instance created with the Amazon linux image and the opworks agent is installed and running. On my instance created from the custom AMI that never happens. The instance simply boots and stays there:

[ec2-user@ip-10-252-81-177 ~]$ pstree
init─┬─abrtd
     ├─agetty
     ├─atd
     ├─auditd───{auditd}
     ├─automount───4*[{automount}]
     ├─certmonger
     ├─crond
     ├─cupsd
     ├─dbus-daemon───{dbus-daemon}
     ├─dhclient
     ├─hald─┬─hald-runner
     │      └─{hald}
     ├─master─┬─pickup
     │        └─qmgr
     ├─6*[mingetty]
     ├─rhsmcertd
     ├─rpc.statd
     ├─rpcbind
     ├─rsyslogd───3*[{rsyslogd}]
     ├─sshd───sshd───sshd───bash───pstree
     └─udevd───2*[udevd]
[ec2-user@ip-10-252-81-177 ~]

No opsworks agent is running and no opswork binary exist: Visit http://aws.amazon.com/opsworks for more information.

[ec2-user@ip-10-252-16-152 ~]$ locate opworks
[ec2-user@ip-10-252-16-152 ~]$ sudo find / -name "*opworks*" -print
[ec2-user@ip-10-252-16-152 ~]$ 

Thanks!

回答1:

I follow this doc: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/creating-an-ami-instance-store.html and I face the same issue. After creating a custom AMI(ubuntu) from EC2, my instance from OpsWorks (which use that custom AMI) stay forever in "booting" Status. The issue was in the process of creating the image with "ec2-bundle-vol" command because:

"By default, the bundle process excludes files that might contain sensitive information. These files include *.sw, *.swo, *.swp, *.pem, *.priv, id_rsa, id_dsa *.gpg, *.jks, */.ssh/authorized_keys, and */.bash_history. To include all of these files, use the --no-filter option."

And when you run the instance form OpsWorks, the instance try to install something which need some gpg signatures files, and other crt, pem files.... The files are exclude from the bundle image... so it fails. The solution is to use the "--no-filter" option or "--include file1,file2,..." Check the ec2-bundle-vol command here: http://docs.aws.amazon.com/AWSEC2/latest/CommandLineReference/CLTRG-ami-bundle-vol.html