Load user data on every boot up of EC2 - amazon-web-services

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.

Related

How to backup Ec2 linux instances along with users

Is there a way to backup users along with software created in AWS.
context:I am currently learning ansible and shutting down those instances created after some time..Everyday i have to recreate again users,,install anisble after relaunching those instances
The natural way to backup EC2 instances is through snapshots. You can also create custom AMI which will simplify launching new instances with all the per-installed software of yours, along with its users and all the settings.

Create a testing copy for EC2 + EB instance

I've my application setup on AWS (EB and EC2). My database is PostgreSQL and it is stored in the EBS service provided by AWS.
I'm going to push a major change to my application (including invasive migrations), to ensure that I don't end up losing data I want to create a copy of my whole application and update the code for that.
The steps I have till now:
Clone an EB instance
Create a snapshot of my EBS and use that to create a new volume
Update the configuration settings of my EB instance to point to the new volume and deploy the new code to the EB instance
I can't find proper documentation for how to do these things on AWS so I'm looking for some confirmation about the steps I have ensure that I don't end up wrecking something.
So the way it works, you create snapshot, create a new EC2 with Disk restored from that snapshot and you have a new EC2 running instance with same DB.
But I would suggest if possible stop the postgresql or the instance before taking a snapshot, this will ensure the state of the DB is intact.
The two EC2 instances will have no relation and changes made in one DB will not impact the other.

How to see ec2 instance details that are created by data pipeline

I have created an ec2 instance using data pipeline. TerminateAfter field value was set to 2 hours. How can i verify the created ec2 instance details(like ip, java versions...) using aws ec2 console?
You will see the instance attributes like ip, region etc., in the dashboard. But if you want system specific information like java version, you have to ssh into the created instance. Make sure you are looking for the instance in the correct region.

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.