How do I save a customized AWS EC2 image (AMI)? - amazon-web-services

So, I am using an ubuntu AMI (amazon machine image). I have installed a couple of compiler, softwares, packages etc on this image. Now I want to save this image; so that I can use it to spawn multiple identical instances of this same AMI. How can I save my create and image of my current AMI instance in order to replicate it to create multiple identical instances?

Create a new AMI Image
Go to the AWS console
go to your EC2 dashboard : in the instances list
select your instance, right click on your instance
select image / create image
This will create an AMI image that you can reuse later

Related

Can I create multiple instance of same ec2 image

I have requirement of creating multiple instances of the same EC2 image from lambda as the EC2 image has some Windows Processing creating PDF files. Can I launch multiple instances of the same EC2 image and pass some parameters to each ec2 instance ( say name of the bucket in S3, and names are different).
Thanks in advance.
An AWS EC2 image provides essentially a snapshot of how the server should look.
This would include:
Any packages you need installed
Any configuration you need
If you want custom configuration applied on top you would need to either:
Make use of UserData when you launch the instance to run those additional actions
Create a custom AMI with the custom configuration included

Instance cloning in AWS

I am having an instance running in AWS, this instance was installed with tomcat, java,DB, etc.,
I want to create an another instance like my running instance.
how to clone my running instance with all the installations to be available in new instance? I read about creating AMI, will it make my new instance with tomcat, java,DB, etc., installed?
Yes, you can create an AMI from your running instance and then launch a new instance from that AMI and it will essentially be a clone.
Choosing the Create Image command on an existing Amazon EC2 instance will create an Amazon Machine Image (AMI) that contains a copy of all disk volumes attached to the instance.
You can then launch a new EC2 instance from the AMI. This will result in the new instance having exactly the same disk content. When launching the new instance you can select a different instance type, network setting, etc -- the only part that will be identical is the content of the disk volumes.
Give it a try, it's very easy!
Select the original instance in the Amazon EC2 management console
Click Actions/Image/Create Image to create the AMI
Select the new AMI in the AMIs section of the console
Select the AMI, then click Actions/Launch to launch a new instance from the AMI
See: Creating an Amazon EBS-Backed Linux AMI

How to create an EC2 instance that others can import into their own VPC

I am new to AWS. I am trying to put my application on AWS. I envision to have two EC2 instances.
My goal is to provide a link to the AWS instance to my users so that they can "import" the instances created by me into their own VPC. By doing so I am planning to save users the pain for setting up my application.
Is this possible to do with AWS? Where should I begin?
You need to create an image of your running AMI and then share it as a "public" AMI.
You can create an image by selecting the running EC2 instance in the console and then under the "Actions" dropdown select "Image" and then "Create Image".
Once your image is created you can modify the permissions using the method outlined in the following docs:
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/sharingamis-intro.html
If you wish to distribute you AMI through the AWS Marketplace there are some hoops that you need to jump through and forms to submit to get your product metadata into the marketplace.
Start by creating an account here:
https://aws.amazon.com/marketplace/management/tour/

Amazon Custom AMI

If I create a custom AMI for an EBS backed EC2 instance after installing numerous applications and making lot of config changes to the EC2 instance like IP Tables, httpd.conf file etc...
Will the custom AMI image capture all those config changes and/or installed applications so that I can use it to launch exact functioning copy of the Custom AMI originating EC2 Instance?
Anything done after launching an EC2 instance will be independent of what the original AMI had. There isn't a relationship among the instances which use the same AMI as well; except that they all were materialised from a single AMI - the individual / independent changes in the Instances ( AMI ) would be in silos.
Coming back to your point; after making numerous changes; you would need to create an image AMI out of the running instance where the changes have been made. Going forward you can use the AMI to create new instances. Already created instances wouldn't reflect any new changes.
This is where the tools like Ansible, Chef, Puppet come into picture.

Load user data on every boot up of EC2

I am having AWS EC2 instance.
I want to load user data on every boot up of EC2 instance.
Whether this is possible or i have to create new instance each time to execute user data?
Multiple options:
create a custom AMI with the users and co figurations you want. Easiest way to do this is to create an EBS backed instance, do the setup, and the. Select the dashboard option to create an AMI from the instance.
have your settings on a remote source(s3 for instance), which your instance is setup to pull and execute/add/configure.
For a single instance, the AMI works well. For a larger environment, configs management like kickstart, puppet, chef, cfengine, or similar will be better.