How it works...

In this recipe, we created an AMI from an EC2 instance. Information related to the launch of an instance, including any Organization-specific configuration, can be saved into an AMI. We used Amazon Linux 2 as our base AMI within this recipe and hence used commands that are specific to Amazon Linux 2. If you are using Amazon Linux 1, you may use the following set of commands instead:

#!/bin/bash
yum update –y
yum install -y httpd
service httpd start
chkconfig httpd on

We did a similar configuration in Chapter 6Working with EC2 Instances, using EC2 user data. Instances from AMIs have faster boot times than instances with the same configuration defined through EC2 user data. This is because we can have packages pre-installed in an AMI, whereas we need to install them at launch with user data.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.172.38