Quick Introduction to Amazon Cloud

Amazon uses Amazon Elastic Cloud Compute (EC2) for provide cloud services. Following are some characteristics of EC2

Elastic IP

Servers are accessed through IP addresses. In the cloud, we spin up new virtual servers on the fly. To efficiently deal with these changes, elastic IPs are used. They are not dynamic addresses assigned to your account. Servers on the cloud are accessed through these elastic IP addresses.

Amazon Machine Image (AMI)

AMI is a packaged environment containing a software stack along with its dependencies that are necessary to set up an EC2 instance. It is the basic unit of deployment. You can create your own AMI or use a prepackage AMI created by a commercial organization or a community.

Elastic Load Balancing (ELB)

ELB handles and distributes traffic to your nodes. It can scale automatically. It allows using a single CNAME for all your servers.


CloudWatch is a resource and application monitoring and alerting service. The purpose of CloudWatch is to enable you to see how your resources are being used and monitor them in real time.

Elastic Block Storage (EBS)

EC2 instances can die once their tasks are completed. The data in these instances also die with the instances. To allow data to live beyond the life of an EC2 instance, data is stored in EBS.

Relational Database Service (RDS)

RDS provides a way to to set up, operate, and scale relational database in the cloud. It is fast and fault tolerant. RDS does not provide SSH or root access. You must use the RDS API for all tasks you are used to using SSH for. RDS can be used to manage every aspect of your database.


Bootstrapping refers to creating a repeatable process that can run independently to get an application up and running on an EC2 instance. This could, for example, involve installing dependencies, pulling code from GIT, deploying, and startup.


Cloud can autoscale when load is higher than the resources allocated could handle with ease. Cloud can autoscale but you need to define what to scale, where to launch, and when to launch. Launch configuration defines what will be scaled in or out. Autoscaling group defines where the new nodes will be launched. Scaling policy defines the conditions that would trigger autoscaling. The policy should define scaling out when there is load and scale in when the extra resources are no longer required.


Amazon offers a few storage options:

  • File Storage - use EFS
  • Block Storage - use EBS and EC2
  • Object Storage - use S3

EFS works very much like your computer's directory structure. All files are classified hierarchically and each has a unique address which is used to retrieve it. Block storage is mostly used by software. Object can be any raw data such as an image, text file, pdf, etc. Objects are non-relational and unstructured. Each object has a unique id. This id is used to retrieve the object. REST API can also be used to access objects.

AWS Services

There are three category of services provided by AWS to assist with implementing elasticity, deployment, and configuration management of applications. Generally, the more convenience you ask for, the less control you will get. You need to decide which service best suits your needs and matches your skillsets:

  1. AWS Elastic Beanstalk: Most convenient, least control
  2. AWS OpsWorks: Mid level convenience and control
  3. AWS CloudFormation: Least convenient but you have the most control

Elastic Beanstalk offers easy-to-use pre-packaged services for scaling and deploying web applications and services using Java, .NET, PHP, Python, Ruby, Docker, Node.js on Apache, Nginx, and IIS. You upload your code, and Beanstalk takes care of the rest; deployment, provisioning, load balancing, auto-scaling, monitoring and other elastic issues. See AWS Elastic Beanstalk intro page.

A common workflow for using beanstalk is the following:

  1. Write code, save name, and version. Then upload to S3. You can import your code from GIT, AWS management console, or use AWS toolkits for Visual Studio or Eclipse.
  2. When code is in S3, beanstalk can deploy it. It handles all everything else.

Beanstalk is not a blackbox. You can see what it is doing and you can reconfigure it. For example, you can change EC2 instance types, database services, switch to https, adjust auto-scaling settings, etc. To change settings, update the .config files inside the .ebextensions folder. .config files are in JSON or YAML format.

OpsWorks offers a good balance between convenience and control. You should consider using it if your application is more complex than what can be supported by Beanstalk. Basically, if you need more granular control of your application setup and deployment, then you need OPsWorks.

Infrastructure is conceptually divided into stacks and layers. A stack is a group of servers that server a purpose together. For example, you application needs an application server, database server, and a caching server. Together, these servers constitute a stack. Applications often have development stacks, staging stacks, and production stacks. Layers conceptually describes the servers by their function. For example, there is a database layer, application layer, etc. In OpsWorks Stacks, all servers can be configured using Chef recipes. Following is an example workflow or OpsWorks usage:

  1. create stack
  2. create layer
  3. define applications
  4. write chef recipes
  5. launch instance
  6. deploy application

OpsWorks will help you with architecture complexities such as configuration management, deployment management, and other elastic issues.

CloudFormation provides easy way to create and manage a collection of AWS resources. It allows you to define and entire application stack. You do this by writing descriptive text files in JSON format. These files can then be used to rebuild identical stacks. Needless to say, CloudFormation is very powerful but you need the technical skills to take full advantage of it and continue maintaining and upgrading it. If you decide to go this route, I would highly recommend that you study CloudFormer first. It will save you a lot of time and effort.


CodeDeploy is a service that coordinates application deployment on EC2 instances. It is a collection of files and scripts, not a language or stack. In the configuration, you would define what to deploy, how to deploy, and where to deploy. Following is a sample workflow, all defined in a single file:

  1. define source files
  2. store to S3 or github
  3. Create CodeDeploy script a. specify which source code b. specify destinations (servers/directories) c. the script to be run for deployment d. define deployment phase

Remember use this, if you are only deploying to existing applications.

Decoupling Components

The benefit of decoupling components is that is reduces tight dependencies and allows the system to scale easily. In a decoupled system, if a component fails, other components continue working and the end user would never notice any failure. Amazon provides SQS, SWS, and SNF to help decouple components.

Simple Queue Service (SQS)

Components communicate with each other. If any component in the chain fails, the entire system fails. To avoid this scenario, we can use SQS to queue communications between components. This way if a component fails, the communication will simply be queued in SQS. This message can then be handled by other components of the same type. SQS provides a reliable, highly scalable, and distributed system for passing messages between components.

Simple Workflow Service (SWS)

SWS helps define, manage, and coordinate tasks that form a given business workflow. Suppose your workflow involves 4 different components to perform a task. These are called activities. SWS also has a decider which help decide which activities to perform. When you start your workflow, the decider will be called to figure out what needs to be done. The decide will send back message to SWS that Activity 1 needs to be called. SWS will call Activity 1, and get the results back. Then SWS will call the decider again. It will decide to call Activity 2, and so on until the workflow is complete. The way all components of a business process are decoupled and function efficiently in a workflow.

Activity helps with the work and decider helps with the flow in a workflow.

Simple Notification Service (SNS)

SNS sends notifications to subscribers. Subscribers can be an application, email, or sms number.

AWS Managed Services

AWS Managed Services are part of Amazon's serverless architecture where you worry about your application and AWS worries about the infrastructure. It provides ongoing management of your AWS infrastructure, automating common activities such as change requests, monitoring, patch management, security, and backup services, and provides full-lifecycle services to provision, run, and support your infrastructure. For serverless architecture, you can either use API gateway or AWS lambda.