How to import existing ec2 instance in aws cdk - amazon-ec2

Does anyone know how to import an existing ec2 instance in aws account using aws CDK?
I searched on the net , also went through the docs.
no luck there!
All helps would be greatly appreciated.

You will have to create a custom static method which has the implementation, this would be similar to the implementation of RDS : https://docs.aws.amazon.com/cdk/api/latest/python/aws_cdk.aws_rds/DatabaseInstanceBase.html
from_database_instance_attributes does a similar job and this can be replicated.

Related

Doubts on moving RDS instance from EC2-Classic to VPC

I need to move RDS oracle instance from EC2-Classic to a VPC, i have some important questions not found on AWS docs:
Is there any downtime ? If so, how much?
The database endpoint will change after the migration?
EC2-VPC instances could still using the db endpoint transparently?
If anyone already did this migration i would like to hear the overall experience.
Thanks!

How to gather information of all the EC2 volumes using ansible?

I am new to ansible and trying to figure out some solutions. Can someone help me with :
Getting all detailed info about all the running instances of EC2
and find out all security groups and the policies attached.
Segregate based on vpcs.
I am assuming that this can be achieved by writing playbook. Any help will be appreciated. Thanks.
Use the EC2 dynamic inventory http://docs.ansible.com/ansible/latest/intro_dynamic_inventory.html#example-aws-ec2-external-inventory-script
Ansible ec2 cloud module will help you to manage AWS platform. To get information about all the instances you can use ec2_remote_facts. To go to advance level I will also recommend to read about AWS dynamic inventory.

How to update code on multiple EC2 instances?

I created an Elastic Load Balancer in front of two EC2 instances. However, I discovered an issue that requires me to update the code on both EC2 instances.
I can access each instance individually to update code via github, or I could create an AMI to launch a new instance. It's very unfavorable.
How can I synchronize code between the two EC2 instances?
In situations like this either a code pipeline would be helpful OR better yet switch to Elastic Beanstalk.

How to find the region of AMI?

In my Project I have one AMI Image-id. I want find out in which region this AMI runs? Can anyone please explain, how to get it without going to AWS console.
use AWS ec2 describe images function http://docs.aws.amazon.com/AWSEC2/latest/CommandLineReference/ApiReference-cmd-DescribeImages.html
using the AWS command line tools.
alternatively you can use Ruby sdk for AWS
http://aws.amazon.com/sdkforruby/

Want to Deploy Task on AWS

I want to deploy my task (which is implemented in Hive) on AWS EC2.
I just read about the AWS, I came to know that we can create our own environment on EC2.
I am completely new to AWS. So I don't know anything about it
How to create such environment there?
I also read that we can import our VM image?
But for that the connector needed for it having .ova extension. If I download it, How to install it? (having .ova extension)
All this things is possible on AWS Free instance (creating our own environment and also VM Import)
Please guide me through this if you know about this.
To setup an instance on Amazon EC2 you might want to go through following guide: http://docs.amazonwebservices.com/AWSEC2/latest/GettingStartedGuide/Welcome.html
Regarding importing your own VM image, you might want to go through following link: Amazon EC2 VM Import. They do support importing images of VMWare, Hyper V etc. In the link you will see 2 options how you can import your image:
Command line option
Amazon EC2 VM Import Connector for VMware vCenter
Personally I know that using command line option has option to provide image file in format specific to your virtual machine software. You can see details of command line options at ec2-import-instance API reference.
Importing an image is free as there is no charge for data coming in to AWS. But there is a change for storing an instance created using image import. Every service has some sort of charge associated with it like per hour charge for instance until instance is up. So those charges are applicable regardless you are importing your image or not. Please see Amazon EC2 pricing at EC2 pricing

Resources