Download our Free AWS Pricing Calculator Spreadsheet. Download Now

Amazon Elastic Computing Cloud (EC2) has enabled thousands of organizations to deploy and manage secure, web-scale computing capacity in the cloud. Amazon EC2 streamlines the processes of establishing server instances, developing and running containerized applications, and scaling those instances to meet processing demands. Amazon provides and uses multiple tools and services to manage these processes efficiently:

In addition to these, Amazon ECS supports API calls that launch Docker-enabled applications as well as access other AWS features such as IAM roles, security groups, Amazon CloudWatch Events, and AWS CloudTrail logs.

Amazon offers detailed guidance on how to create Amazon EC2 instances. An experienced sysadmin or developer likely has these steps memorized and can complete the process in minutes. However, for someone new to the Amazon EC2 environment, the process can be challenging, given all the steps, command lines, and variety of tools involved.

Having worked directly with various organizations, I want to provide some useful guidance to complement the directions provided by Amazon, to help you plan ahead and consider some of the decisions you’ll need to make. In providing this information, I’m assuming that you’ve already established an AWS account, created a virtual private cloud and security groups, and installed AWS Command Line Interface (CLI). Your developers have written the application, and you’re now logged into your Amazon EC2 account.

1. Launch an Amazon EC2 Instance

You’ll need to create a key pair or use a pair already created. Open the Amazon E2C console and select an Amazon Machine Image (AMI), choose your instance type, configure the instance details—network (your default VPC), subnet, storage, and security group—select the key pair, then launch the instance.

  • Considerations: Amazon offers a selection of instance types (CPU, memory, storage, and networking capacity) designed to fit a wide range of use cases. Understand how the application will be used and anticipate potential peak workloads. Select the instance type that provides the appropriate resource mix for your application’s target workload.

2. Configure EC2 File Storage to Meet Your Application and Regulatory Requirements

Open the EFS console, choose your default VPC, name your file system, and add descriptive tags. If your application requires it, enable data encryption and lifecycle management (to take advantage of lower-cost infrequent access storage).

  • Considerations: Understand the type of data you’ll be acquiring and managing. Depending upon the industry and geography there may be multiple regulatory requirements that govern Personally Identifiable Information (PII) and other data types. Failure to comply with regulations can bring both economic sanctions and reputational damage. Understand your application’s data usage patterns to ensure the storage option you’ve selected doesn’t impede processing efficiency.

3. Connect to the New EC2 Instance and Mount the File System

This is a straightforward sequence of tasks and commands. Note that after you launch an EC2 instance, it may take a few minutes to complete before you can connect. Connect to the EC2 instance and install the amazon-efs-utils package following the directions provided by Amazon. If you have existing data in on-premises storage you can use AWS DataSync to transfer files to EFS.

  • Considerations: Wholesale transfer of existing data to EFS may not be the best use of time and storage. Conduct an analysis of your existing data. You may actually save time and money (and improve application performance) by transferring only a relevant subset.

4. Install Docker on the EC2 Instance

This is a simple, straightforward process. With the EC2 instance launched, use the command lines specified in Installing Docker to complete and verify the installation.

5. Create the Docker Image for an Application

Amazon ECS uses Docker images to launch containers on the instances you’ve created. The Docker utility automatically builds the images by reading instructions from a Dockerfile, a text file containing the commands to assemble an image. The Docker daemon runs the instructions in the Dockerfile one-by-one before finally outputting the ID of the new image. You’ll need to work with your developers to generate a set of instructions and create the Dockerfile that contains the commands that comply with the Dockerfile format.

  • Considerations: Successful creation of a Dockerfile can take some time to get the command sequence and syntax correct. If you’re new to Docker, seek the expertise and experience of someone who has already mastered the Docker command language.

6. Create the Elastic Container Registry (ECR)

ECR is a Docker container registry for storage, management, and deployment of Docker container images. Integration with ECS provides reliable deployment of containers. Use the AWS CLI to create a registry then use Docker CLI to push your image to the elastic container registry.

  • Considerations: Creation of the ECR could be one of the first steps in this overall process. It doesn’t absolutely need to follow this particular sequence.

7. Plan Next Steps, Starting With Task Definitions

Before you can run Docker containers on Amazon ECS, you will need to create a task definition using AWS CLI. However, I’ll cover that topic in detail in a future blog post, addressing scheduling, load balancing and a host of other considerations that impact application performance.

Creating Amazon EC2 Instances—A Few Additional Considerations

In this brief overview, I’ve outlined the process of creating Amazon EC2 instances—yet each of these steps can benefit from a more detailed discussion to enhance the efficiency of the overall process. When creating EC2 instances, your overarching goal should be to configure the parameters and allocate sufficient resources to maximize the value of your AWS investment. With many critical decisions to make, the guidance of an experienced partner can help ensure your decisions are sound.

Whether it’s application development, launching an EC2 instance, scripting Docker files, orchestrating resources to handle scale, availability, and quick updates, or running the application in a production environment, success in each of these areas requires experience and expertise. If you’re just embarking on a new EC2 initiative, we’d welcome the opportunity to discuss the specifics of your business needs with one of our specialists.

AWS EC2 icon

Mission is an AWS Cloud Consulting and Managed Service Provider that can help businesses implement a scalable and cost-efficient EC2 cloud environment. Mission has Certified AWS Engineers in place to address your automated cloud computing needs. Feel free to contact us anytime.

About the author:
author
Kiril Dubrovsky

Senior Solutions Architect




Let's discuss your cloud journey

Free AWS Consultation