EC2 instance image on VirtualBOX? - amazon-ec2

Is there any way of getting the saved EC2 instance image and running it on virtualbox on my personal computer?

The official way is only if it was originally imported into EC2
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ExportingEC2Instances.html
If you have previously imported an instance into Amazon EC2, you can
use the command line tools to export that instance to Citrix Xen,
Microsoft Hyper-V, or VMware vSphere. Exporting an instance can be
useful when you want to deploy a copy of your EC2 instance in your
on-site virtualization environment.
You cannot export an instance unless it was previously imported into AWS

it looks like you can directly import/export ec2 and virtualbox/vmware images.
http://aws.amazon.com/ec2/vmimport/

The amazon tool is very restrictive. But you can dump your EBS, download it and make a VDI image out of it. I have done it with two of my EC2 instances and described the steps on my blog.
http://diogomelo.net/blog/16/export-amazon-ec2-instance-to-virtualbox

Related

How to change windows hostname while launching in amazon cloudformation template

I want to mention the host name of the instance in the Cloud Formation Template while launching the teplate for a windows instance. How can I do that?
The user data field is not getting executed since it was not enabled. Need to enable user-data in ec2-config in windows machine and stop the machine and then take the AMI. By using new AMI this would work.

Using vagrant on EC2

I need to setup a web server and a database server on EC2.
It should be easy to migrate to another service provider later.
Currently, I have a web server and a database server, each running on separate EC2 micro instances with software installed there remotely.
Can we run a vagrant box on these micro instances with pre-installed and pre-configured softwares like LAMP stack and use that instead. So I will end with 2 vagrant boxes , one for web server another for database server.
Amazon provides already means to copy an instance but it is copied to another EC2 instance only probably .. If there is need to move to some other provider, it will be same process of re-installing all. So, an own virtual box installed on Amazon's virtual box is what i was looking into..
I don't know how good or bad it is.. I doubt if this will affect performance as well. Please share your views. Target is to have env prepared locally and have flexibility to deploy it on any service provider easily.
Running vagrant inside your AWS box is probably not the right solution. Have you looked into the Vagrant AWS provider?
That will allow you to setup and provision your AWS boxes with Vagrant and Puppet or Chef... if you are using Puppet or Chef to provision your servers then you will have a very portable "scripted" install for your servers that can easily be moved to another provider at a later date...
So running a virtual machine, on another virtual machine probably isn't the best. But if you want to install Vagrant on Amazon Linux you can do:
wget https://releases.hashicorp.com/vagrant/2.2.4/vagrant_2.2.4_x86_64.rpm
sudo rpm -ivh vagrant_2.2.4_x86_64.rpm
The RPM is the Centos version from the downloads page here: https://www.vagrantup.com/downloads.html
But then you cannot install virtualbox to run a VM. So it doesn't actually work anyways.

Difference between Amazon EC2 API tools and AMI tools?

The developer tools page here list two set of tools for Amazon EC2
Amazon EC2 API tools
Amazon EC2 AMI tools
What are the differences between the two set of tools?
The API tools serve as the client interface to the Amazon EC2 web service. Use these tools to register and launch instances, manipulate security groups, and more
The Amazon EC2 AMI Tools are command-line utilities to help bundle an Amazon Machine Image (AMI), create an AMI from an existing machine or installed volume, and upload a bundled AMI to Amazon S3.
From the definitions shown at Developer Tools.
So, if you want to manage instances, use API tools; if you want to build and upload an AMI (Amazon Machine Image), use AMI tools.
Here are the lines from Amazon Documentation:
The Amazon EC2 command line interface tools (also called the CLI tools) wrap the Amazon EC2 API actions. These tools are written in Java and include shell scripts for both Windows and Linux/UNIX/Mac OSX.
Note
Alternatively, you can use the AWS Command Line Interface (AWS CLI), which provides commands for a broad set of AWS products, including Amazon EC2. To get started with the AWS CLI, see the AWS Command Line Interface User Guide. For more information about the AWS CLI commands for Amazon EC2, see ec2 in the AWS Command Line Interface Reference.
Before you can use the Amazon EC2 CLI tools, you need to download them and configure them to use your AWS account. You can set up the tools on your own computer or on an Amazon EC2 instance.
http://docs.aws.amazon.com/AWSEC2/latest/CommandLineReference/set-up-ec2-cli-windows.html

Replacing Rackspace Cloud SITES with Amazon EC2 Instances

So at work we run a bunch of sites on rackspaces cloud sites platform. This works alright, except I have no way of tweaking anything server side and I find that they sometimes aren't as responsive as they could be.
Let's assume that most of the sites are bloated wordpress installations.
Would it be possible to use EC2 micro instances to host these? (One instance per site)?
I want to move away from rackspace as I have no flexibility with cloud sites and prefer Amazons services.
Sure! You can easily do that!
Sign up for EC2 here.
Go to http://alestic.com/ and chose AMI (Ubuntu AMIs for EC2 drop-down) you want to start instance from.
Start EC2 Micro Instance by hitting the links (or use API Tools). You can use user-data to install desired software on instance start, but I recommend (for simplicity) just to start Instance and install software via terminal using SSH. Follow the dialog and create RSA key to connect your Instance.
Connect to your Instance over ssh using RSA key.
Install software. For example: sudo su, then apt-get update && apt-get install -y ntp php5-fpm nginx wordpress [...].
Create AMI from running Instance with installed and configured software.
Launch more Instances from your own AMI bundled with Wordpress and stuff!
Full disclosure: I am a rackspace employee.
If you want more flexibility than rackspace cloud sites, then you can use rackspace cloud server. You will have all the flexibility of the cloud. If you like the managed part of cloud sites, then i would suggest managed cloud server.

Create New EC2 Instance with Custom ISO

I'm using Switchvox, an Asterisk PBX and I'd like to host it on EC2.
Digium Switchvox provides an ISO which contains everything needed to host the pbx server: OS, software, etc. It's basically an image of the server.
How do I instantiate a new EC2 instance using the custom ISO they're providing?
From this ISO, you can create either a VMware or VirtualBox image. Form there, you may convert this image into an EC2 AMI image and go from there.
Just make sure you are using the same arch (32 v. 64) and proper kernel.
That being said, you might get into more operations then simply fire up an existing vanilla AMI available from the community. There might be one that closely match your OS requirements.
Overview:
Check pre-requisites
Install your ISO onto VMware vSphere then export as VMDK
Upload your VMDK to an S3 bucket on the same AWS account
Install and configure AWS command line interface (CLI)
Setup a VM Import Service Role
Use the CLI to import the VM from S3 into an Amazon Machine Instance (AMI)
This is a lengthy process, so it's worth reading through the pre-requisites. Pay particular attention to the supported operating systems / Linux distributions and versions.
They clearly state "Note that you can only import VMDK files into Amazon EC2 that were created through the OVF export process in VMware."
For example, you can get a VMDK using VirtualBox, but if you try to import this you might see the following error, when checking the status:
aws ec2 describe-import-image-tasks --import-task-ids import-ami-someid
"StatusMessage": "ClientError: Disk validation failed [Unsupported VMDK File Format]"
However, there is some Oracle documentation on exporting a virtual machine in the Open Virtualization Format (OVF).
If all goes well, you can launch the newly imported AMI as usual.
You can create a VMware virtual machine using your custom ISO and move it from your VMware host to EC2. Read more: VM Import/Export
Only Windows Server 2008 variants can be converted from VMDK to AMI.

Resources