Difference between Amazon EC2 API tools and AMI tools? - amazon-ec2

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

Related

Continuous Integration With VSTS and AWS EC2 Instances

We are managing source code in the VSTS there we had the Main Git Branch. And now we want to automate the deployment/release process with AWS EC2 instance.
We installed the AWS Toolkit for Visual Studio 2017 from the marketplace.
Can anyone guide how to deploy to AWS EC2 instance from VSTS?
You are talking about IaaS (Infrastructure as a code) there are several ways which you can able to achieve this.
Tools like terraform, ansible, cloud formation we're some popular tools which you can able to create an Ec2 instance from VSTS or Azure DevOps.
For an instance you can see here on how you can create an ec2 instance using terraform.
You can install the terraform extension from market place into your azure devops account.

Launching ECS service from our own AMI

I am trying to deploy my sample Spring Cloud Microservice into AWS ECS service. I found that Fargate method and EC2 launch method. Here actually I am looking for to launch ECS service from my own EC2 instance. Now I have only Ubuntu 16.04 AMI. I am planning to use AWS ECS optimized AMI as my EC2. So I need to launch ECS using my own EC2. So I am confused about the launching by optimized my own EC2.
I am seeking useful links or documentation for launching using above method. Since I am beginning stage on AWS Cloud.
The AMI you've configured for your instance doesn't matter (generally). Once your EC2 instance is created, go over to the ECS section of AWS and create a cluster containing your host.
In ECS you need to define a task containing your container, the repo to pull it from, and all the other necessary details. From here you can go to your cluster and launch your task on your host, either manually, or by defining a service to automate the launching for you.

Deploy Application to AWS EC2 Instance using terraform

I need to deploy my Java application to AWS EC2 Instance using terraform. The catch here, we should not use *.pem file to deploy the application.
I try to create ELB and associate instances using terraform.I can able to deploy the application using ssh and pem file to ec2 instances Private IPs. But we shouldn't use *.pem or *.ppk file, as it'll not be allowed in production servers.
I tried using chef with terraform , but that also requires *.pem to connect to AWS Instances.
Please let me know the detailed steps/suggestions of how to deploy the application using terraform without using pem file.
If you can't make any changes to your instance after creating it (including deploying the application) then you will need to bake any and all changes into the AMI that Terraform deploys.
You might want to look into using Packer to create AMIs with your intended configuration and then use Terraform to deploy these AMIs.
For reference, this strategy is known as "immutable infrastructure" so you might want to do some further reading into this area.
If instead it's simply that SSH connectivity is not allowed and you can make changes over other ports then you should be able to use an AMI that has a Chef client, Puppet agent or Salt minion on it (there may well be other tools that work over a non SSH protocol/port but this restriction rules out Ansible) and then use any of those tools to continue to configure your instance. Obviously you could find a suitable AMI from the AMI marketplace or, once again, use Packer to set up the relevant configuration management client.

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.

EC2 instance image on VirtualBOX?

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

Resources