If I create the custom AMI, (This AMI is imported from VMware server using the import-image) can i use the user data while launching the instance from this AMI?Means cloud-init will be available in the custom AMI using the import-image? OS are RHEL..
You would need to install the cloud-init service on the VM you are creating the custom AMI from. That isn't something AWS does for you automatically.
Related
I am trying to create AMI from an existing Windows Instance with No Reboot and launch a new instance from the AMI with userdata.
But the userdata is not getting triggered.
Is there anyway to enable userdata execution without letting the main instance to reboot
I found the issue, while taking AMI the task scheduler "Amazon Ec2 Launch - Instance Initialization" inside the machine from which i take AMI is disabled. If we enable the task schedule and take an AMI from it, we will be able to execute userdata for the new machine
I need to use a specific custom Windows AMI as the base image to build an AMI to be used by EKS worker nodes. How do I do that?
I have created my own EC2 instance in AWS. That AMI is AWS ECS optimized AMI for launching ecs service from my EC2 instance. I previously discussed the same thing. And tried with that approach. The link is below,
Microservice Deployment Using AWS ECS Service
I created my cluster and configured that cluster name when I am creating optimized AMI by following code snippet in advanced userdata section,
#!/bin/bash
echo ECS_CLUSTER=your_cluster_name >> /etc/ecs/ecs.config
I followed the documentation of cluster creation from following link,
https://docs.aws.amazon.com/AmazonECS/latest/developerguide/create_cluster.htmlecs
But, no result - when creating cluster and ECS task definitions it creates and launches into one EC2. And again creating another EC2 by specifying above code. So total 2 Ec2. I already created my own ECS optimized.
I am finding for launching ECS service from my own AMI (that I created). Actually I need to launch my ECS service from my Ec2 (I had created my machine Amazon optimized AMI).
The reason behind this requirement is I don't want to launch my services in machine that owned by others. I need to launch from my machine. And also I need to host my angular application in the same my machine. So I need control of my machine. How can I do this?
Sounds like you just need to create a Launch Configuration. With this you can specify the User Data settings that should be applied when a host is setup.
After you create your Launch Configuration, create a new Auto Scaling Group based off of it (there's a drop-down to select the launch configuration you want to use).
From here, any new instances launched under that ASG will apply the settings you've configured in the associated Launch Configuration.
We have used Elastic Beanstalk for creating the EC2 instances. Is it possible to screate the new EC2 instance with the existing EC2 instance image, when the existing EC2 instance is getting terminated in any case? Can we achieve this by any configuration?
I don't think this is possible.
As soon as you send a terminate request on your EC2 instance, the IP and hardware (disk and other resources) are released.
If you are trying to do this programmatically, I'd suggest you create an AMI before sending a terminate request.
You can create an AMI from the EC2 before you terminate it, and then create a new Elastic Beanstalk environment using this AMI. However, it's not advisable as you'll lose future version upgrades of that AMI as performed by Amazon.
I advise you use the .ebextensions folder mechanism supplied by Elastic Beanstalk in order to alter new instances as they are spawned (see documentation).
Or is it absolutely necessary to have an EBS backed storage? Does anyone have manuals/Howtos?
I am following the manual given on this site.
You can create an AMI from either an EBS or S3-backed running instance. The simplest way is to use the AWS Management Console to select the instance and click 'Create Image' from the Instance Actions menu.
This will create either an EBS or S3-backed AMI, depending on the type of instance.
Be aware that creating an AMI from a Running instance is inherently potentially unsafe - the storage is not imaged as a hard 'point-in-time' snapshot, so changes to the filesystem whilst the image is being created may not be recorded, and may even result in a compromised image. You should quiesce the OS as far as possible before starting.
Note also that your instance will reboot during the image-creation process, so make sure you're prepared for any temporary loss of service from the VM.
If you bundle a Windows EBS instance while it is running, its Administrator password will be reset by Amazon's rebundling tools - so you'll have to use the EC2 "get Admin password" function with instances launched from the new AMI.
If you stop your Windows instance before rebundling, its Administrator password will remain intact through the rebundling process.
I don't know if this is documented anywhere, but it's certainly been my experience with Windows 2003 instances.
you will to refer the manual for the three commands:
ec2-bundle-vol, ec2-upload-bundle, ec2-register.
Keep at hand your private and certificate key (eg. pk.pem, cert.pem files) and your access and shared key. Download the ec2 ami tools and setup the environment variables for the ec2 ami tools. This site might give you the details on how to bundle the volume, create the images, upload them to S3 and finally register it as your own ami.
http://alestic.com/2009/06/ec2-ami-bundle
It is possible to create an AMI from an EBS running instance using the AWS management console. as mentioned by Eight-Bit Guru by clicking 'Create Image' from the Instance Actions menu.
For the S3 backed instance it is currently not possible without bundling the instance.
If you are using a linux ami then you have two ways as explained in this guide:
Creating an AMI from S3 backed instance - For Linux
For windows based S3 backed instance you can follow other guide
Creating an AMI from S3 backed instance - For Windows
Hope this will help for creating an AMI for S3 backed intances.