17.08.2017 Views

overview-of-deployment-options-on-aws (1)

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Overview <str<strong>on</strong>g>of</str<strong>on</strong>g> Deployment<br />

Opti<strong>on</strong>s <strong>on</strong> AWS<br />

Peter Dalbhanjan<br />

March 2015


© 2015, Amaz<strong>on</strong> Web Services, Inc. or its affiliates. All rights reserved.<br />

Notices<br />

This document is provided for informati<strong>on</strong>al purposes <strong>on</strong>ly. It represents AWS’s<br />

current product <str<strong>on</strong>g>of</str<strong>on</strong>g>ferings and practices as <str<strong>on</strong>g>of</str<strong>on</strong>g> the date <str<strong>on</strong>g>of</str<strong>on</strong>g> issue <str<strong>on</strong>g>of</str<strong>on</strong>g> this document,<br />

which are subject to change without notice. Customers are resp<strong>on</strong>sible for<br />

making their own independent assessment <str<strong>on</strong>g>of</str<strong>on</strong>g> the informati<strong>on</strong> in this document<br />

and any use <str<strong>on</strong>g>of</str<strong>on</strong>g> AWS’s products or services, each <str<strong>on</strong>g>of</str<strong>on</strong>g> which is provided “as is”<br />

without warranty <str<strong>on</strong>g>of</str<strong>on</strong>g> any kind, whether express or implied. This document does<br />

not create any warranties, representati<strong>on</strong>s, c<strong>on</strong>tractual commitments, c<strong>on</strong>diti<strong>on</strong>s<br />

or assurances from AWS, its affiliates, suppliers or licensors. The resp<strong>on</strong>sibilities<br />

and liabilities <str<strong>on</strong>g>of</str<strong>on</strong>g> AWS to its customers are c<strong>on</strong>trolled by AWS agreements, and<br />

this document is not part <str<strong>on</strong>g>of</str<strong>on</strong>g>, nor does it modify, any agreement between AWS<br />

and its customers.


Amaz<strong>on</strong> Web Services – Deployment Opti<strong>on</strong>s <strong>on</strong> AWS March 2015<br />

C<strong>on</strong>tents<br />

Introducti<strong>on</strong> 4<br />

AWS Deployment Services 5<br />

AWS Elastic Beanstalk 5<br />

AWS CloudFormati<strong>on</strong> 6<br />

AWS OpsWorks 6<br />

AWS CodeCommit 6<br />

AWS CodePipeline 6<br />

AWS CodeDeploy 7<br />

Amaz<strong>on</strong> EC2 C<strong>on</strong>tainer Service 7<br />

Comm<strong>on</strong> Features 7<br />

Provisi<strong>on</strong> 8<br />

Deploy 9<br />

C<strong>on</strong>figure 9<br />

Scale 9<br />

M<strong>on</strong>itoring 9<br />

Logging 10<br />

Instance Pr<str<strong>on</strong>g>of</str<strong>on</strong>g>iles 10<br />

Custom Variables 11<br />

Other AWS Service Integrati<strong>on</strong> 11<br />

Tags 11<br />

Strategies for Updating Your Stacks 12<br />

Prebaking AMIs 12<br />

In-place vs Disposable Method 13<br />

Blue-Green Method 15<br />

Hybrid Deployment Model Approach 17<br />

C<strong>on</strong>clusi<strong>on</strong> 20<br />

Page 3 <str<strong>on</strong>g>of</str<strong>on</strong>g> 23


Amaz<strong>on</strong> Web Services – Deployment Opti<strong>on</strong>s <strong>on</strong> AWS March 2015<br />

Abstract<br />

Amaz<strong>on</strong> Web Services <str<strong>on</strong>g>of</str<strong>on</strong>g>fers multiple <str<strong>on</strong>g>opti<strong>on</strong>s</str<strong>on</strong>g> for provisi<strong>on</strong>ing your IT<br />

infrastructure and the <str<strong>on</strong>g>deployment</str<strong>on</strong>g> <str<strong>on</strong>g>of</str<strong>on</strong>g> your applicati<strong>on</strong>s. Whether it is a simple<br />

three-tier applicati<strong>on</strong> or a complex set <str<strong>on</strong>g>of</str<strong>on</strong>g> workloads, the <str<strong>on</strong>g>deployment</str<strong>on</strong>g> model varies<br />

from customer to customer. But with the right techniques, AWS can help you pick<br />

the best strategy and tool set for deploying an infrastructure that can handle your<br />

workload.<br />

This whitepaper is intended for any<strong>on</strong>e looking for informati<strong>on</strong> <strong>on</strong> different<br />

<str<strong>on</strong>g>deployment</str<strong>on</strong>g> services in AWS. It lays out comm<strong>on</strong> features available <strong>on</strong> these<br />

<str<strong>on</strong>g>deployment</str<strong>on</strong>g> services, articulates strategies for updating applicati<strong>on</strong> stacks, and<br />

presents few examples <str<strong>on</strong>g>of</str<strong>on</strong>g> hybrid <str<strong>on</strong>g>deployment</str<strong>on</strong>g> models for complex workloads<br />

Introducti<strong>on</strong><br />

AWS caters to multiple customers with several unique requirements. If you are<br />

an experienced user working <strong>on</strong> the AWS platform, you are probably aware <str<strong>on</strong>g>of</str<strong>on</strong>g> the<br />

“<strong>on</strong>e size doesn’t fit all” philosophy. Whether you work in enterprise computing<br />

or hope to create the next big social media or gaming company, AWS provides<br />

multiple customizati<strong>on</strong> <str<strong>on</strong>g>opti<strong>on</strong>s</str<strong>on</strong>g> to serve a broad range <str<strong>on</strong>g>of</str<strong>on</strong>g> use cases. The AWS<br />

platform is designed to address scalability, performance, security, ease <str<strong>on</strong>g>of</str<strong>on</strong>g><br />

<str<strong>on</strong>g>deployment</str<strong>on</strong>g>, tools to help migrate applicati<strong>on</strong>s and an ecosystem <str<strong>on</strong>g>of</str<strong>on</strong>g> developers<br />

and architects who are deeply involved in the growth <str<strong>on</strong>g>of</str<strong>on</strong>g> its products and services.<br />

For example, several sizing <str<strong>on</strong>g>opti<strong>on</strong>s</str<strong>on</strong>g> are available to roll out an applicati<strong>on</strong> <strong>on</strong><br />

Amaz<strong>on</strong> Elastic Compute Cloud (EC2) instance al<strong>on</strong>g with various scaling<br />

mechanics for adding compute and storage capacity. 1 For persistent data storage<br />

needs, Amaz<strong>on</strong> Elastic Block Store (EBS) has tiered <str<strong>on</strong>g>of</str<strong>on</strong>g>ferings such as general<br />

purpose (SSD), provisi<strong>on</strong>ed IOPS (SSD) and magnetic EBS volumes. 2 For data<br />

that is static in nature, you can use Amaz<strong>on</strong> Simple Storage Service (S3) 3 and<br />

Amaz<strong>on</strong> Glacier 4 for archival purposes. For data that is relati<strong>on</strong>al in nature, you<br />

can leverage Amaz<strong>on</strong> Relati<strong>on</strong>al Database Service (RDS); 5 for data warehousing,<br />

you can use Amaz<strong>on</strong> Redshift. 6 If you need storage with pre-defined throughput,<br />

you can leverage Amaz<strong>on</strong> DynamoDB 7 and for real-time processing, you can use<br />

Amaz<strong>on</strong> Kinesis. 8<br />

Page 4 <str<strong>on</strong>g>of</str<strong>on</strong>g> 23


Amaz<strong>on</strong> Web Services – Deployment Opti<strong>on</strong>s <strong>on</strong> AWS March 2015<br />

Similarly, when it comes to <str<strong>on</strong>g>deployment</str<strong>on</strong>g> services, AWS has multiple <str<strong>on</strong>g>opti<strong>on</strong>s</str<strong>on</strong>g> too.<br />

The following diagram summarizes different <str<strong>on</strong>g>deployment</str<strong>on</strong>g> services in AWS.<br />

Figure 1: Overview <str<strong>on</strong>g>of</str<strong>on</strong>g> Deployment Services<br />

AWS Deployment Services<br />

AWS <str<strong>on</strong>g>of</str<strong>on</strong>g>fers multiple strategies for provisi<strong>on</strong>ing infrastructure. You could use the<br />

building blocks (Amaz<strong>on</strong> EC2, Amaz<strong>on</strong> EBS, Amaz<strong>on</strong> S3, Amaz<strong>on</strong> RDS) and<br />

leverage the integrati<strong>on</strong> provided by third-party tools to deploy your applicati<strong>on</strong>.<br />

But for even greater flexibility, you can c<strong>on</strong>sider the automati<strong>on</strong> provided by the<br />

AWS <str<strong>on</strong>g>deployment</str<strong>on</strong>g> services.<br />

AWS Elastic Beanstalk<br />

AWS Elastic Beanstalk is the fastest and simplest way to get an applicati<strong>on</strong> up<br />

and running <strong>on</strong> AWS. 9 It is perfect for developers who want to deploy code and<br />

not worry about managing the underlying infrastructure. Elastic Beanstalk is<br />

ideal if you have a standard three tier PHP, Java, Pyth<strong>on</strong>, Ruby, Node.js, .NET,<br />

Go or Docker applicati<strong>on</strong> that can run <strong>on</strong> an app server with a database. 10 Elastic<br />

Beanstalk uses Auto Scaling 11 and Elastic Load Balancing 12 to easily support<br />

highly variable amounts <str<strong>on</strong>g>of</str<strong>on</strong>g> traffic and works for you if you want to start small and<br />

scale up. Comm<strong>on</strong> use cases include web apps, c<strong>on</strong>tent management systems<br />

(CMS), and API back ends.<br />

Page 5 <str<strong>on</strong>g>of</str<strong>on</strong>g> 23


Amaz<strong>on</strong> Web Services – Deployment Opti<strong>on</strong>s <strong>on</strong> AWS March 2015<br />

AWS CloudFormati<strong>on</strong><br />

AWS CloudFormati<strong>on</strong> provides the sysadmin, network architect, and other IT<br />

pers<strong>on</strong>nel the ability to provisi<strong>on</strong> and manage stacks <str<strong>on</strong>g>of</str<strong>on</strong>g> AWS resources based <strong>on</strong><br />

templates you create to model your infrastructure architecture. 13 You can manage<br />

anything from a single Amaz<strong>on</strong> EC2 instance to a complex multitier,<br />

multiregi<strong>on</strong>al applicati<strong>on</strong>. Using templates means you can impose versi<strong>on</strong> c<strong>on</strong>trol<br />

<strong>on</strong> your infrastructure and easily replicate your infrastructure stack quickly and<br />

with repeatability. AWS CloudFormati<strong>on</strong> is recommended if you want a tool for<br />

granular c<strong>on</strong>trol over the provisi<strong>on</strong>ing and management <str<strong>on</strong>g>of</str<strong>on</strong>g> your own<br />

infrastructure. AWS CodeDeploy is a recommended adjunct to AWS<br />

CloudFormati<strong>on</strong> for managing the applicati<strong>on</strong> <str<strong>on</strong>g>deployment</str<strong>on</strong>g>s and updates. 14<br />

AWS OpsWorks<br />

AWS OpsWorks is an applicati<strong>on</strong>-management service that makes it easy for both<br />

developers and operati<strong>on</strong>s pers<strong>on</strong>nel to deploy and operate applicati<strong>on</strong>s <str<strong>on</strong>g>of</str<strong>on</strong>g> all<br />

shapes and sizes. 15 AWS OpsWorks works best if you want to deploy your code,<br />

have some abstracti<strong>on</strong> from the underlying infrastructure, and have an<br />

applicati<strong>on</strong> more complex than a three-tier architecture. AWS OpsWorks is also<br />

recommended if you want to manage your infrastructure with a c<strong>on</strong>figurati<strong>on</strong><br />

management system such as Chef.<br />

AWS CodeCommit<br />

AWS CodeCommit is a highly available, highly scalable managed source-c<strong>on</strong>trol<br />

service that hosts private Git repositories. 16 With AWS CodeCommit, you can<br />

store anything from code to binaries and work seamlessly with your existing Gitbased<br />

tools. CodeCommit integrates with AWS CodePipeline and AWS<br />

CodeDeploy to streamline your development and release process.<br />

AWS CodePipeline<br />

AWS CodePipeline is a c<strong>on</strong>tinuous delivery and release automati<strong>on</strong> service for<br />

rapidly releasing new features to users. 17 With AWS CodePipeline, you can design<br />

your development workflow for checking in code, building the code, deploying<br />

your applicati<strong>on</strong> into staging, testing it, and releasing it to producti<strong>on</strong>. AWS<br />

CodePipeline can be easily integrated or extended by leveraging third-party tools<br />

into any step <str<strong>on</strong>g>of</str<strong>on</strong>g> your release process or you can use AWS CodePipeline as an end-<br />

Page 6 <str<strong>on</strong>g>of</str<strong>on</strong>g> 23


Amaz<strong>on</strong> Web Services – Deployment Opti<strong>on</strong>s <strong>on</strong> AWS March 2015<br />

to-end soluti<strong>on</strong>. For best results, use AWS CodeCommit al<strong>on</strong>g with AWS<br />

CodePipeline to streamline your development and release cycles.<br />

AWS CodeDeploy<br />

AWS CodeDeploy is a service that coordinates applicati<strong>on</strong> <str<strong>on</strong>g>deployment</str<strong>on</strong>g>s across<br />

Amaz<strong>on</strong> EC2 instances. 18 AWS CodeDeploy works with your existing applicati<strong>on</strong><br />

files and <str<strong>on</strong>g>deployment</str<strong>on</strong>g> scripts, and it can easily reuse existing c<strong>on</strong>figurati<strong>on</strong><br />

management scripts. The service scales with your infrastructure so you can<br />

deploy to as few as <strong>on</strong>e EC2 instance or thousands. AWS CodeDeploy is a good<br />

choice if you want to deploy code to infrastructure managed by yourself or other<br />

people in your organizati<strong>on</strong>. Use AWS CodeDeploy to deploy code to<br />

infrastructure that is provisi<strong>on</strong>ed and managed with AWS CloudFormati<strong>on</strong>. Even<br />

if you d<strong>on</strong>’t use AWS CloudFormati<strong>on</strong> but you use Amaz<strong>on</strong> EC2 with third-party<br />

integrati<strong>on</strong>, AWS CodeDeploy can help manage your applicati<strong>on</strong> <str<strong>on</strong>g>deployment</str<strong>on</strong>g>.<br />

Amaz<strong>on</strong> EC2 C<strong>on</strong>tainer Service<br />

Amaz<strong>on</strong> EC2 C<strong>on</strong>tainer Service 19 is a highly scalable, high performance c<strong>on</strong>tainer<br />

management service that makes it easy to run, stop, and manage Docker<br />

c<strong>on</strong>tainers <strong>on</strong> a cluster <str<strong>on</strong>g>of</str<strong>on</strong>g> Amaz<strong>on</strong> EC2 instances. With Amaz<strong>on</strong> EC2 C<strong>on</strong>tainer<br />

Service you can manage c<strong>on</strong>tainer-enabled applicati<strong>on</strong>s with simple API calls, get<br />

the state <str<strong>on</strong>g>of</str<strong>on</strong>g> your cluster from a centralized service, and gain access to many<br />

familiar Amaz<strong>on</strong> EC2 features like security groups, 20 Amaz<strong>on</strong> EBS volumes, and<br />

AWS Identity and Access Management (IAM) roles. 21 Amaz<strong>on</strong> EC2 C<strong>on</strong>tainer<br />

Service is a good opti<strong>on</strong> if you are using Docker for a c<strong>on</strong>sistent build and<br />

<str<strong>on</strong>g>deployment</str<strong>on</strong>g> experience, if you want to improve the utilizati<strong>on</strong> <str<strong>on</strong>g>of</str<strong>on</strong>g> your EC2<br />

instances, or as the basis for sophisticated distributed systems.<br />

Comm<strong>on</strong> Features<br />

AWS <str<strong>on</strong>g>of</str<strong>on</strong>g>fers several key features that are unique to each <str<strong>on</strong>g>deployment</str<strong>on</strong>g> service.<br />

However, there are some characteristics that are comm<strong>on</strong> to these services. Each<br />

feature can influence service adopti<strong>on</strong> in its own way. The following table<br />

discusses some <str<strong>on</strong>g>of</str<strong>on</strong>g> the comm<strong>on</strong> features in the <str<strong>on</strong>g>deployment</str<strong>on</strong>g> services:<br />

Page 7 <str<strong>on</strong>g>of</str<strong>on</strong>g> 23


Amaz<strong>on</strong> Web Services – Deployment Opti<strong>on</strong>s <strong>on</strong> AWS March 2015<br />

Deployment Category Descripti<strong>on</strong> AWS Elastic<br />

Feature 1 Beanstalk<br />

AWS Cloud<br />

Formati<strong>on</strong><br />

AWS<br />

OpsWorks<br />

AWS<br />

CodeDeploy<br />

Provisi<strong>on</strong><br />

Provisi<strong>on</strong><br />

infrastructure<br />

EC2 instances,<br />

Amaz<strong>on</strong> EBS<br />

volumes, VPC,<br />

etc.<br />

(Details) 2 (Details) (Details) N/A<br />

Deploy<br />

Deploy<br />

applicati<strong>on</strong>s<br />

Deploy<br />

applicati<strong>on</strong>s from<br />

chosen repository<br />

(Details) 2 (Details) (Details) (Details)<br />

C<strong>on</strong>figure<br />

C<strong>on</strong>figurati<strong>on</strong><br />

management<br />

Install s<str<strong>on</strong>g>of</str<strong>on</strong>g>tware,<br />

c<strong>on</strong>figure s<str<strong>on</strong>g>of</str<strong>on</strong>g>tware<br />

and AWS<br />

resources<br />

(Details) (Details) (Details)<br />

Scale Scalability Automatically<br />

scale to handle<br />

the load<br />

M<strong>on</strong>itoring M<strong>on</strong>itoring M<strong>on</strong>itor events,<br />

resources,<br />

applicati<strong>on</strong> health<br />

(Details) (Details) (Details) N/A<br />

(Details) (Details) (Details) (Details)<br />

Logging<br />

Troubleshooting,<br />

security<br />

System,<br />

applicati<strong>on</strong> logs<br />

(Details) (Details) (Details) (Details)<br />

Instance<br />

pr<str<strong>on</strong>g>of</str<strong>on</strong>g>iles<br />

Security<br />

Securely access<br />

AWS services<br />

such as Amaz<strong>on</strong><br />

S3, DynamoDB<br />

(Details) (Details) (Details) (Details)<br />

Custom<br />

variables<br />

C<strong>on</strong>figurati<strong>on</strong><br />

management<br />

Pass variables to<br />

applicati<strong>on</strong><br />

envir<strong>on</strong>ments<br />

(Details) (Details) (Details) N/A<br />

Other AWS<br />

service<br />

integrati<strong>on</strong><br />

Service<br />

integrati<strong>on</strong><br />

Integrati<strong>on</strong> with<br />

other AWS<br />

services<br />

(Details) (Details) (Details) (Details)<br />

Tags<br />

Security,<br />

troubleshooting,<br />

c<strong>on</strong>figurati<strong>on</strong><br />

management<br />

Automate<br />

c<strong>on</strong>figuring tags<br />

<strong>on</strong> EC2, Amaz<strong>on</strong><br />

RDS<br />

(Details) (Details) (Details)<br />

1. Lists <strong>on</strong>ly the relevant <str<strong>on</strong>g>deployment</str<strong>on</strong>g> service with the comm<strong>on</strong> feature set.<br />

2. Elastic Beanstalk provisi<strong>on</strong>s the resources to support either web applicati<strong>on</strong> that handles HTTP(S) requests or a web applicati<strong>on</strong> that<br />

handles background-processing tasks.<br />

Provisi<strong>on</strong><br />

As menti<strong>on</strong>ed earlier, you can work with the building blocks such as Amaz<strong>on</strong><br />

EC2, Amaz<strong>on</strong> EBS, Amaz<strong>on</strong> S3, Amaz<strong>on</strong> Virtual Private Cloud (VPC)<br />

Page 8 <str<strong>on</strong>g>of</str<strong>on</strong>g> 23


Amaz<strong>on</strong> Web Services – Deployment Opti<strong>on</strong>s <strong>on</strong> AWS March 2015<br />

individually, 22 or you can use the automati<strong>on</strong> provided by <str<strong>on</strong>g>deployment</str<strong>on</strong>g> services<br />

for provisi<strong>on</strong>ing infrastructure comp<strong>on</strong>ents. The advantage <str<strong>on</strong>g>of</str<strong>on</strong>g> using these<br />

services is the rich feature set they bring for deploying and c<strong>on</strong>figuring your<br />

applicati<strong>on</strong>, m<strong>on</strong>itoring, scalability, integrati<strong>on</strong> with other AWS services and<br />

more. A detailed discussi<strong>on</strong> <str<strong>on</strong>g>of</str<strong>on</strong>g> these features will make this clear.<br />

Deploy<br />

The <str<strong>on</strong>g>deployment</str<strong>on</strong>g> services can also make it easier to deploy your applicati<strong>on</strong> <strong>on</strong> the<br />

underlying infrastructure. You can create an applicati<strong>on</strong>, specify the source to<br />

your desired <str<strong>on</strong>g>deployment</str<strong>on</strong>g> service, and let the tool handle the complexity <str<strong>on</strong>g>of</str<strong>on</strong>g><br />

provisi<strong>on</strong>ing the AWS resources needed to run your applicati<strong>on</strong>. Despite<br />

providing similar functi<strong>on</strong>ality in terms <str<strong>on</strong>g>of</str<strong>on</strong>g> <str<strong>on</strong>g>deployment</str<strong>on</strong>g>, each service has its own<br />

unique method for deploying and managing your applicati<strong>on</strong>.<br />

C<strong>on</strong>figure<br />

In additi<strong>on</strong> to deploying your applicati<strong>on</strong>, you can use the <str<strong>on</strong>g>deployment</str<strong>on</strong>g> services to<br />

customize and manage the applicati<strong>on</strong> c<strong>on</strong>figurati<strong>on</strong>. The underlying task could<br />

be replacing custom c<strong>on</strong>figurati<strong>on</strong> files (such as httpd.c<strong>on</strong>f) for your custom<br />

web applicati<strong>on</strong> or updating packages that are required by your applicati<strong>on</strong> (such<br />

as yum and apt-get repositories). You can customize the s<str<strong>on</strong>g>of</str<strong>on</strong>g>tware <strong>on</strong> your<br />

Amaz<strong>on</strong> EC2 instance as well as the infrastructure resources in your stack<br />

c<strong>on</strong>figurati<strong>on</strong>.<br />

Scale<br />

Scaling your applicati<strong>on</strong> fleet during periods <str<strong>on</strong>g>of</str<strong>on</strong>g> increased demand not <strong>on</strong>ly<br />

provides a better experience for your end users but also keeps the cost low. You<br />

can c<strong>on</strong>figure Auto Scaling to dynamically add or remove Amaz<strong>on</strong> EC2 instances<br />

based <strong>on</strong> metrics triggers that you set in Amaz<strong>on</strong> CloudWatch (CPU, memory,<br />

disk I/O, network I/O). 23 This type <str<strong>on</strong>g>of</str<strong>on</strong>g> Auto Scaling c<strong>on</strong>figurati<strong>on</strong> is integrated<br />

seamlessly into Elastic Beanstalk and AWS CloudFormati<strong>on</strong>. Similarly, you can<br />

use AWS OpsWorks to automatically manage scaling based <strong>on</strong> time or load.<br />

M<strong>on</strong>itoring<br />

M<strong>on</strong>itoring gives you visibility into the resources you launch in the cloud.<br />

Whether you want to m<strong>on</strong>itor the resource utilizati<strong>on</strong> <str<strong>on</strong>g>of</str<strong>on</strong>g> your overall stack or get<br />

Page 9 <str<strong>on</strong>g>of</str<strong>on</strong>g> 23


Amaz<strong>on</strong> Web Services – Deployment Opti<strong>on</strong>s <strong>on</strong> AWS March 2015<br />

an <str<strong>on</strong>g>overview</str<strong>on</strong>g> <str<strong>on</strong>g>of</str<strong>on</strong>g> your applicati<strong>on</strong> health, the <str<strong>on</strong>g>deployment</str<strong>on</strong>g> services help provide this<br />

info from single pane <str<strong>on</strong>g>of</str<strong>on</strong>g> glass. You can also navigate to the CloudWatch c<strong>on</strong>sole<br />

to get a system-wide view into all <str<strong>on</strong>g>of</str<strong>on</strong>g> your resources and operati<strong>on</strong>al health. You<br />

can use similar techniques to create alarms for metrics that you want to m<strong>on</strong>itor.<br />

Alarms can send an alert whenever a certain threshold is met or take an acti<strong>on</strong> to<br />

mitigate an issue. For example, you can set an alarm that sends an email alert<br />

when an EC2 instance fails <strong>on</strong> status checks or trigger a scaling event when the<br />

CPU utilizati<strong>on</strong> meets certain threshold.<br />

Each <str<strong>on</strong>g>deployment</str<strong>on</strong>g> services provide the progress <str<strong>on</strong>g>of</str<strong>on</strong>g> your <str<strong>on</strong>g>deployment</str<strong>on</strong>g>. You can<br />

track the resources that are being created or removed via AWS Management<br />

C<strong>on</strong>sole, 24 CLI, 25 or APIs. 26<br />

Logging<br />

Logging is an important element <str<strong>on</strong>g>of</str<strong>on</strong>g> your applicati<strong>on</strong> <str<strong>on</strong>g>deployment</str<strong>on</strong>g> cycle. Logging<br />

can provide important debugging informati<strong>on</strong> or provide key characteristics <str<strong>on</strong>g>of</str<strong>on</strong>g><br />

your applicati<strong>on</strong> behavior. The <str<strong>on</strong>g>deployment</str<strong>on</strong>g> services make it simpler to access<br />

these logs through a combinati<strong>on</strong> <str<strong>on</strong>g>of</str<strong>on</strong>g> the AWS Management C<strong>on</strong>sole, CLI, and API<br />

methods so that you d<strong>on</strong>’t have to log into Amaz<strong>on</strong> EC2 instances to view them.<br />

In additi<strong>on</strong> to built-in features, the <str<strong>on</strong>g>deployment</str<strong>on</strong>g> services provide seamless<br />

integrati<strong>on</strong> with CloudWatch Logs to expand your ability to m<strong>on</strong>itor the system,<br />

applicati<strong>on</strong>, and custom log files. 27 You can use CloudWatch Logs to m<strong>on</strong>itor logs<br />

from EC2 instances in real time, m<strong>on</strong>itor CloudTrail events, or archive log data in<br />

Amaz<strong>on</strong> S3 for future analysis. 28<br />

Instance Pr<str<strong>on</strong>g>of</str<strong>on</strong>g>iles<br />

Instance pr<str<strong>on</strong>g>of</str<strong>on</strong>g>iles 29 is a great way <str<strong>on</strong>g>of</str<strong>on</strong>g> embedding necessary IAM roles required to<br />

carry out an operati<strong>on</strong> to access an AWS resource. These IAM roles can securely<br />

make API requests from your instances to AWS services without requiring you to<br />

manage security credentials. The <str<strong>on</strong>g>deployment</str<strong>on</strong>g> services integrate seamlessly with<br />

instance pr<str<strong>on</strong>g>of</str<strong>on</strong>g>iles to simplify credentials management and relieve you from<br />

hardcoding API keys in your applicati<strong>on</strong> c<strong>on</strong>figurati<strong>on</strong>.<br />

For example, if your applicati<strong>on</strong> needs to access an Amaz<strong>on</strong> S3 bucket with read<strong>on</strong>ly<br />

permissi<strong>on</strong>, you can create an instance pr<str<strong>on</strong>g>of</str<strong>on</strong>g>ile and assign read-<strong>on</strong>ly Amaz<strong>on</strong><br />

Page 10 <str<strong>on</strong>g>of</str<strong>on</strong>g> 23


Amaz<strong>on</strong> Web Services – Deployment Opti<strong>on</strong>s <strong>on</strong> AWS March 2015<br />

S3 access in the associated IAM role. The <str<strong>on</strong>g>deployment</str<strong>on</strong>g> service will take the<br />

complexity <str<strong>on</strong>g>of</str<strong>on</strong>g> passing these roles to EC2 instance so that your applicati<strong>on</strong> can<br />

securely access AWS resource with the privileges that you define.<br />

Custom Variables<br />

When you develop an applicati<strong>on</strong>, you want to customize c<strong>on</strong>figurati<strong>on</strong> values<br />

such as database c<strong>on</strong>necti<strong>on</strong> strings, security credentials, or other informati<strong>on</strong><br />

that you d<strong>on</strong>’t want to hardcode into your applicati<strong>on</strong>. Defining variables can<br />

help loosely couple your applicati<strong>on</strong> c<strong>on</strong>figurati<strong>on</strong> and gives you the flexibility to<br />

scale different tiers <str<strong>on</strong>g>of</str<strong>on</strong>g> your applicati<strong>on</strong> independently. Embedding variables<br />

outside <str<strong>on</strong>g>of</str<strong>on</strong>g> your applicati<strong>on</strong> code also helps improve portability <str<strong>on</strong>g>of</str<strong>on</strong>g> your<br />

applicati<strong>on</strong>. Additi<strong>on</strong>ally, you can differentiate envir<strong>on</strong>ments into development,<br />

test, and producti<strong>on</strong> based <strong>on</strong> customized variables. The <str<strong>on</strong>g>deployment</str<strong>on</strong>g> services<br />

help facilitate customizing variables so that <strong>on</strong>ce they are set, the variables<br />

become available to your applicati<strong>on</strong> envir<strong>on</strong>ments.<br />

Other AWS Service Integrati<strong>on</strong><br />

AWS <str<strong>on</strong>g>deployment</str<strong>on</strong>g> services provide easier integrati<strong>on</strong> with other AWS services.<br />

Whether you need to load balance across multiple Availability Z<strong>on</strong>es 30 by using<br />

Elastic Load Balancing or by using Amaz<strong>on</strong> RDS as a back end, the <str<strong>on</strong>g>deployment</str<strong>on</strong>g><br />

services like AWS Elastic Beanstalk, AWS CloudFormati<strong>on</strong>, and AWS OpsWorks<br />

make it simpler to use these services as part <str<strong>on</strong>g>of</str<strong>on</strong>g> your <str<strong>on</strong>g>deployment</str<strong>on</strong>g>.<br />

If you need to use other AWS services, you can leverage tool-specific integrati<strong>on</strong><br />

methods to interact with the resource. For example, if you are using Elastic<br />

Beanstalk for <str<strong>on</strong>g>deployment</str<strong>on</strong>g> and want to use DynamoDB for your back end, you can<br />

customize your envir<strong>on</strong>ment resources by including a c<strong>on</strong>figurati<strong>on</strong> file within<br />

your applicati<strong>on</strong> source bundle. 31 With AWS OpsWorks, you can create custom<br />

recipes to c<strong>on</strong>figure the applicati<strong>on</strong> so that it can access other AWS services. 32<br />

Similarly, several template snippets with a number <str<strong>on</strong>g>of</str<strong>on</strong>g> example scenarios are<br />

available for you to use within your AWS CloudFormati<strong>on</strong> templates. 33<br />

Tags<br />

Another advantage <str<strong>on</strong>g>of</str<strong>on</strong>g> using a <str<strong>on</strong>g>deployment</str<strong>on</strong>g> service is to reap the benefits <str<strong>on</strong>g>of</str<strong>on</strong>g><br />

automating tag usage. A tag c<strong>on</strong>sists <str<strong>on</strong>g>of</str<strong>on</strong>g> a user-defined key and value. You can<br />

define tags based <strong>on</strong> applicati<strong>on</strong>, project, cost centers, business divisi<strong>on</strong>, and<br />

Page 11 <str<strong>on</strong>g>of</str<strong>on</strong>g> 23


Amaz<strong>on</strong> Web Services – Deployment Opti<strong>on</strong>s <strong>on</strong> AWS March 2015<br />

more so that you can easily identify a resource. When you use tags during your<br />

<str<strong>on</strong>g>deployment</str<strong>on</strong>g> steps, the tools automatically propagate the tags to underlying<br />

resources such as Amaz<strong>on</strong> EC2 instances, Auto Scaling groups, or Amaz<strong>on</strong> RDS.<br />

Appropriate use <str<strong>on</strong>g>of</str<strong>on</strong>g> tagging can provide a better way to manage your costs with<br />

cost allocati<strong>on</strong> reports. 34 Cost allocati<strong>on</strong> reports aggregate costs based <strong>on</strong> tags.<br />

This way, you can determine how much you are spending for each applicati<strong>on</strong> or<br />

a particular project.<br />

Strategies for Updating Your Stacks<br />

Depending <strong>on</strong> your choice <str<strong>on</strong>g>of</str<strong>on</strong>g> <str<strong>on</strong>g>deployment</str<strong>on</strong>g> service, the strategy for updating your<br />

applicati<strong>on</strong> code could vary a fair amount. AWS <str<strong>on</strong>g>deployment</str<strong>on</strong>g> services bring agility<br />

and improve the speed <str<strong>on</strong>g>of</str<strong>on</strong>g> your applicati<strong>on</strong> <str<strong>on</strong>g>deployment</str<strong>on</strong>g> cycle, but using a proper<br />

tool and the right strategy is key for building a robust envir<strong>on</strong>ment.<br />

The following secti<strong>on</strong> looks at how the <str<strong>on</strong>g>deployment</str<strong>on</strong>g> service can help while<br />

performing applicati<strong>on</strong> updates. The approaches menti<strong>on</strong>ed below will start with<br />

prebaking machine images and then move to performing in-place and disposable<br />

upgrades.<br />

Prebaking AMIs<br />

An Amaz<strong>on</strong> Machine Image (AMI) is an image c<strong>on</strong>sisting <str<strong>on</strong>g>of</str<strong>on</strong>g> a base operating<br />

system or an applicati<strong>on</strong> server in the cloud. 35 In order to launch an EC2<br />

instance, you need to choose which AMI you will use for installing your<br />

applicati<strong>on</strong>. A comm<strong>on</strong> practice to install an applicati<strong>on</strong> is during instance boot.<br />

This process is called bootstrapping an instance. AWS CloudFormati<strong>on</strong> provides<br />

multiple <str<strong>on</strong>g>opti<strong>on</strong>s</str<strong>on</strong>g> for bootstrapping an applicati<strong>on</strong>. To review the <str<strong>on</strong>g>opti<strong>on</strong>s</str<strong>on</strong>g> in detail,<br />

see Bootstrapping Applicati<strong>on</strong>s via AWS CloudFormati<strong>on</strong> . 36<br />

Note that the bootstrapping process can be slower if you have a complex<br />

applicati<strong>on</strong> or multiple applicati<strong>on</strong>s to install. Managing a fleet <str<strong>on</strong>g>of</str<strong>on</strong>g> applicati<strong>on</strong>s<br />

with several build tools and dependencies can be a challenging task during<br />

rollouts. Furthermore, your <str<strong>on</strong>g>deployment</str<strong>on</strong>g> service should be designed to do faster<br />

rollouts to take advantage <str<strong>on</strong>g>of</str<strong>on</strong>g> Auto Scaling.<br />

Page 12 <str<strong>on</strong>g>of</str<strong>on</strong>g> 23


Amaz<strong>on</strong> Web Services – Deployment Opti<strong>on</strong>s <strong>on</strong> AWS March 2015<br />

Prebaking is a process <str<strong>on</strong>g>of</str<strong>on</strong>g> embedding a significant porti<strong>on</strong> <str<strong>on</strong>g>of</str<strong>on</strong>g> your applicati<strong>on</strong><br />

artifacts within your base AMI. During the <str<strong>on</strong>g>deployment</str<strong>on</strong>g> process you can<br />

customize applicati<strong>on</strong> installati<strong>on</strong>s by using EC2 instance artifacts such as<br />

instance tags, instance metadata, and Auto Scaling groups.<br />

For example, let’s say you are managing a Ruby applicati<strong>on</strong> that needs Nginx for<br />

the fr<strong>on</strong>t end; Elasticsearch, Logstash, and Kibana for log processing; and<br />

M<strong>on</strong>goDB for document management. You can have logical grouping <str<strong>on</strong>g>of</str<strong>on</strong>g> your base<br />

AMIs that can take 80% <str<strong>on</strong>g>of</str<strong>on</strong>g> applicati<strong>on</strong> binaries loaded <strong>on</strong> these AMI sets. You<br />

can choose to install most applicati<strong>on</strong>s during the bootstrapping process and<br />

alter the installati<strong>on</strong> based <strong>on</strong> c<strong>on</strong>figurati<strong>on</strong> sets grouped by instance tags, Auto<br />

Scaling groups, or other instance artifacts. You can set a tag <strong>on</strong> your Nginx<br />

instances (such as Nginx-v-1.6.2). Your update process can query for the instance<br />

tag, validate whether it’s the most current versi<strong>on</strong> <str<strong>on</strong>g>of</str<strong>on</strong>g> Nginx, and then proceed<br />

with the installati<strong>on</strong>. When it’s time to update the prebaked AMI, you can simply<br />

swap your existing AMI with the most recent versi<strong>on</strong> in the underlying<br />

<str<strong>on</strong>g>deployment</str<strong>on</strong>g> service and update the tag.<br />

Deployment services like AWS CloudFormati<strong>on</strong> and AWS OpsWorks are better<br />

suited for the prebaked AMI approach. You can also find multiple third-party<br />

tools for prebaking AMIs. Some well-known <strong>on</strong>es are packer.io 37 and aminator<br />

(built by Netflix). 38 You can also choose third-party tools for your c<strong>on</strong>figurati<strong>on</strong><br />

management such as Chef, Puppet, Salt, Ansible, and Capistrano.<br />

In-place vs Disposable Method<br />

The <str<strong>on</strong>g>deployment</str<strong>on</strong>g> services <str<strong>on</strong>g>of</str<strong>on</strong>g>fer two methods to help you update your applicati<strong>on</strong><br />

stack, namely in-place and disposable. An in-place upgrade involves performing<br />

applicati<strong>on</strong> updates <strong>on</strong> live Amaz<strong>on</strong> EC2 instances. A disposable upgrade, <strong>on</strong> the<br />

other hand, involves rolling out a new set <str<strong>on</strong>g>of</str<strong>on</strong>g> EC2 instances by terminating older<br />

instances.<br />

An in-place upgrade is typically useful in a rapid <str<strong>on</strong>g>deployment</str<strong>on</strong>g> with a c<strong>on</strong>sistent<br />

rollout schedule. It is designed for sessi<strong>on</strong>less applicati<strong>on</strong>s. You can still use the<br />

in-place upgrade method for stateful applicati<strong>on</strong>s by implementing a rolling<br />

<str<strong>on</strong>g>deployment</str<strong>on</strong>g> schedule and by following the guidelines menti<strong>on</strong>ed in the secti<strong>on</strong> <strong>on</strong><br />

blue-green <str<strong>on</strong>g>deployment</str<strong>on</strong>g>s.<br />

Page 13 <str<strong>on</strong>g>of</str<strong>on</strong>g> 23


Amaz<strong>on</strong> Web Services – Deployment Opti<strong>on</strong>s <strong>on</strong> AWS March 2015<br />

In c<strong>on</strong>trast, disposable upgrades <str<strong>on</strong>g>of</str<strong>on</strong>g>fer a simpler way to know if your applicati<strong>on</strong><br />

has unknown dependencies. The underlying EC2 instance usage is c<strong>on</strong>sidered<br />

temporary or ephemeral in nature for the period <str<strong>on</strong>g>of</str<strong>on</strong>g> <str<strong>on</strong>g>deployment</str<strong>on</strong>g> until the current<br />

release is active. During the new release, a new set <str<strong>on</strong>g>of</str<strong>on</strong>g> EC2 instances are rolled out<br />

by terminating older instances. This type <str<strong>on</strong>g>of</str<strong>on</strong>g> upgrade technique is more comm<strong>on</strong><br />

in an immutable infrastructure.<br />

Two services are especially useful for an in-place upgrade: You can use AWS<br />

CodeDeploy to manage the updates while managing applicati<strong>on</strong> <str<strong>on</strong>g>deployment</str<strong>on</strong>g><br />

using the building blocks (Amaz<strong>on</strong> EC2, Amaz<strong>on</strong> EBS, Amaz<strong>on</strong> S3, Amaz<strong>on</strong> RDS)<br />

individually or third-party managed build systems like Github, Jenkins, Travis<br />

CI, or Circle CI. Alternatively, you can use AWS OpsWorks to manage both your<br />

applicati<strong>on</strong> <str<strong>on</strong>g>deployment</str<strong>on</strong>g> as well as updates.<br />

For disposable upgrades, you can set up a cl<strong>on</strong>ed envir<strong>on</strong>ment with the<br />

<str<strong>on</strong>g>deployment</str<strong>on</strong>g> services (AWS Elastic Beanstalk, AWS CloudFormati<strong>on</strong>, and AWS<br />

OpsWorks) or use them in combinati<strong>on</strong> with an Auto Scaling c<strong>on</strong>figurati<strong>on</strong> to<br />

manage the updates.<br />

In-place Upgrade Method<br />

AWS CodeDeploy is a tool focused <strong>on</strong> s<str<strong>on</strong>g>of</str<strong>on</strong>g>tware <str<strong>on</strong>g>deployment</str<strong>on</strong>g>. You can deploy<br />

applicati<strong>on</strong>s from Amaz<strong>on</strong> S3 and GitHub repositories using this tool. Once you<br />

prepare <str<strong>on</strong>g>deployment</str<strong>on</strong>g> c<strong>on</strong>tent and the underlying Amaz<strong>on</strong> EC2 instances, you can<br />

deploy an applicati<strong>on</strong> and its revisi<strong>on</strong>s <strong>on</strong> a c<strong>on</strong>sistent basis. You can push the<br />

updates to a set <str<strong>on</strong>g>of</str<strong>on</strong>g> instances called <str<strong>on</strong>g>deployment</str<strong>on</strong>g> groups that are made <str<strong>on</strong>g>of</str<strong>on</strong>g> tagged<br />

EC2 instances 39 and/or Auto Scaling groups. 40 In additi<strong>on</strong>, AWS CodeDeploy<br />

works with various c<strong>on</strong>figurati<strong>on</strong> management tools, c<strong>on</strong>tinuous integrati<strong>on</strong> and<br />

<str<strong>on</strong>g>deployment</str<strong>on</strong>g> systems, and source c<strong>on</strong>trol systems. You can find complete list <str<strong>on</strong>g>of</str<strong>on</strong>g><br />

product integrati<strong>on</strong> <str<strong>on</strong>g>opti<strong>on</strong>s</str<strong>on</strong>g> in the AWS CodeDeploy documentati<strong>on</strong>. 41<br />

Another service to use for managing the entire lifecycle <str<strong>on</strong>g>of</str<strong>on</strong>g> an applicati<strong>on</strong> is AWS<br />

OpsWorks. You can use built-in layers or deploy custom layers and recipes to<br />

launch your applicati<strong>on</strong> stack. In additi<strong>on</strong>, t<strong>on</strong>s <str<strong>on</strong>g>of</str<strong>on</strong>g> customizati<strong>on</strong> <str<strong>on</strong>g>opti<strong>on</strong>s</str<strong>on</strong>g> are<br />

available for c<strong>on</strong>figurati<strong>on</strong> and pushing applicati<strong>on</strong> updates. For more<br />

informati<strong>on</strong>, read the whitepaper <strong>on</strong> Managing Multi-Tiered Web Applicati<strong>on</strong><br />

with OpsWorks for reviewing strategies to update OpsWorks stacks. 42<br />

Page 14 <str<strong>on</strong>g>of</str<strong>on</strong>g> 23


Amaz<strong>on</strong> Web Services – Deployment Opti<strong>on</strong>s <strong>on</strong> AWS March 2015<br />

Disposable Upgrade Method<br />

You can perform disposable upgrades in a couple <str<strong>on</strong>g>of</str<strong>on</strong>g> ways. You can use an Auto<br />

Scaling policy to define how you want to add (scale out) or remove (scale in)<br />

instances. 43 By coupling this with your update strategy, you can c<strong>on</strong>trol rolling<br />

out <str<strong>on</strong>g>of</str<strong>on</strong>g> an applicati<strong>on</strong> update as part <str<strong>on</strong>g>of</str<strong>on</strong>g> the scaling event.<br />

For example, you can update Auto Scaling to use the new AMI and c<strong>on</strong>figure a<br />

terminati<strong>on</strong> policy to use OldestInstance during a scale in event. Or you could use<br />

OldestLaunchC<strong>on</strong>figurati<strong>on</strong> to phase out all instances that use the previous<br />

c<strong>on</strong>figurati<strong>on</strong>. If you are using an Elastic Load Balancing (ELB), you can attach<br />

an additi<strong>on</strong>al Auto Scaling c<strong>on</strong>figurati<strong>on</strong> behind the ELB and use a similar<br />

approach to phase in newer instances while removing older instances.<br />

Similarly, you can c<strong>on</strong>figure rolling <str<strong>on</strong>g>deployment</str<strong>on</strong>g>s in c<strong>on</strong>juncti<strong>on</strong> with <str<strong>on</strong>g>deployment</str<strong>on</strong>g><br />

services such as AWS Elastic Beanstalk 44 and AWS CloudFormati<strong>on</strong>. 45 You can<br />

use update policies to describe how instances in an Auto Scaling group are<br />

replaced or modified as part <str<strong>on</strong>g>of</str<strong>on</strong>g> your update strategy. You can c<strong>on</strong>trol the number<br />

<str<strong>on</strong>g>of</str<strong>on</strong>g> instances to get updated c<strong>on</strong>currently or in batches. You can choose to apply<br />

the updates to certain instances while isolating in-service instances. You can also<br />

specify the time to wait between batched updates. In additi<strong>on</strong>, you can cancel or<br />

roll back an update if you discover a bug in your applicati<strong>on</strong> code. These features<br />

can help increase the availability <str<strong>on</strong>g>of</str<strong>on</strong>g> your applicati<strong>on</strong> during updates. See the next<br />

secti<strong>on</strong> <strong>on</strong> blue-green <str<strong>on</strong>g>deployment</str<strong>on</strong>g>s to address some c<strong>on</strong>cerns related to<br />

managing updates for sessi<strong>on</strong>ful applicati<strong>on</strong>s using Auto Scaling.<br />

Blue-Green Method<br />

Blue-green is a method in which you have two identical stacks <str<strong>on</strong>g>of</str<strong>on</strong>g> your applicati<strong>on</strong><br />

running in their own envir<strong>on</strong>ments. You use various strategies to migrate the<br />

traffic from your current applicati<strong>on</strong> stack (blue) to a new versi<strong>on</strong> <str<strong>on</strong>g>of</str<strong>on</strong>g> the<br />

applicati<strong>on</strong> (green). This is a popular technique for deploying applicati<strong>on</strong>s with<br />

zero downtime. The <str<strong>on</strong>g>deployment</str<strong>on</strong>g> services like AWS Elastic Beanstalk, AWS<br />

CloudFormati<strong>on</strong>, or AWS OpsWorks are particularly useful as they provide a<br />

simple way to cl<strong>on</strong>e your running applicati<strong>on</strong> stack. You can set up a new versi<strong>on</strong><br />

<str<strong>on</strong>g>of</str<strong>on</strong>g> your applicati<strong>on</strong> (green) by simply cl<strong>on</strong>ing current versi<strong>on</strong> <str<strong>on</strong>g>of</str<strong>on</strong>g> the applicati<strong>on</strong><br />

(blue).<br />

Page 15 <str<strong>on</strong>g>of</str<strong>on</strong>g> 23


Amaz<strong>on</strong> Web Services – Deployment Opti<strong>on</strong>s <strong>on</strong> AWS March 2015<br />

For a sessi<strong>on</strong>less web applicati<strong>on</strong>, the update process is pretty straightforward.<br />

Simply upload the new versi<strong>on</strong> <str<strong>on</strong>g>of</str<strong>on</strong>g> your applicati<strong>on</strong> and let your <str<strong>on</strong>g>deployment</str<strong>on</strong>g><br />

service (AWS Elastic Beanstalk, AWS CloudFormati<strong>on</strong>, or AWS OpsWorks)<br />

deploy a new versi<strong>on</strong> (green). To cut over to the new versi<strong>on</strong>, you simply replace<br />

the ELB URLs in your DNS records. Elastic Beanstalk has a Swap<br />

Envir<strong>on</strong>ment URLs feature to facilitate a simpler cutover process. If you use<br />

Amaz<strong>on</strong> Route 53 to manage your DNS records, you need to swap ELB endpoints<br />

for AWS CloudFormati<strong>on</strong> or AWS OpsWorks <str<strong>on</strong>g>deployment</str<strong>on</strong>g> services. 46<br />

Figure 2: Blue-Green Deployment<br />

For applicati<strong>on</strong>s with sessi<strong>on</strong> states, the cutover process can be complex. When<br />

you perform an update, you d<strong>on</strong>’t want your end users to experience downtime or<br />

lose data. You should c<strong>on</strong>sider storing the sessi<strong>on</strong>s outside <str<strong>on</strong>g>of</str<strong>on</strong>g> your <str<strong>on</strong>g>deployment</str<strong>on</strong>g><br />

service because with certain <str<strong>on</strong>g>deployment</str<strong>on</strong>g> service creating a new stack will recreate<br />

the sessi<strong>on</strong> database. In particular, c<strong>on</strong>sider storing the sessi<strong>on</strong>s separately from<br />

your <str<strong>on</strong>g>deployment</str<strong>on</strong>g> service if you are using Amaz<strong>on</strong> RDS database or Amaz<strong>on</strong><br />

ElastiCache. 47<br />

Page 16 <str<strong>on</strong>g>of</str<strong>on</strong>g> 23


Amaz<strong>on</strong> Web Services – Deployment Opti<strong>on</strong>s <strong>on</strong> AWS March 2015<br />

Read additi<strong>on</strong>al recommendati<strong>on</strong>s for achieving zero downtime with Elastic<br />

Beanstalk during your applicati<strong>on</strong> upgrade. 48 Similarly, review the<br />

recommendati<strong>on</strong> for updating AWS CloudFormati<strong>on</strong> stacks while preventing<br />

updates to stack resources. 49 In additi<strong>on</strong>, c<strong>on</strong>sider m<strong>on</strong>itoring your instances in<br />

the blue <str<strong>on</strong>g>deployment</str<strong>on</strong>g> and ELB’s c<strong>on</strong>necti<strong>on</strong> draining before terminating<br />

instances. 50<br />

If you use Amaz<strong>on</strong> Route53 to host your DNS records, you can c<strong>on</strong>sider using the<br />

Weighted Round Robin (WRR) feature for migrating from blue to green<br />

<str<strong>on</strong>g>deployment</str<strong>on</strong>g>s. The feature helps to drive the traffic gradually rather than<br />

instantly. 51 If your applicati<strong>on</strong> has a bug, this method helps ensure the blast<br />

radius is minimal as it <strong>on</strong>ly affects small number <str<strong>on</strong>g>of</str<strong>on</strong>g> users. This method also<br />

simplifies rollbacks if they become necessary. In additi<strong>on</strong>, you <strong>on</strong>ly use the<br />

required number <str<strong>on</strong>g>of</str<strong>on</strong>g> instances while you scale up in the green and scale down in<br />

the blue <str<strong>on</strong>g>deployment</str<strong>on</strong>g>. For example, you can set WRR to allow 10% <str<strong>on</strong>g>of</str<strong>on</strong>g> the traffic to<br />

go to green <str<strong>on</strong>g>deployment</str<strong>on</strong>g> while keeping 90% <str<strong>on</strong>g>of</str<strong>on</strong>g> traffic <strong>on</strong> blue. You gradually<br />

increase the percentage <str<strong>on</strong>g>of</str<strong>on</strong>g> green instances until you achieve a full cutover.<br />

Keeping the DNS cache to a shorter TTL <strong>on</strong> the client side also ensures the client<br />

will c<strong>on</strong>nect to green <str<strong>on</strong>g>deployment</str<strong>on</strong>g> with rapid release cycle thus minimizing bad<br />

DNS caching behavior.<br />

Hybrid Deployment Model Approach<br />

You can also use the <str<strong>on</strong>g>deployment</str<strong>on</strong>g> services in a hybrid fashi<strong>on</strong> for managing your<br />

applicati<strong>on</strong> fleet. For example, you can combine the simplicity <str<strong>on</strong>g>of</str<strong>on</strong>g> managing AWS<br />

infrastructure provided by Elastic Beanstalk and the automati<strong>on</strong> <str<strong>on</strong>g>of</str<strong>on</strong>g> custom<br />

network segmentati<strong>on</strong> provided by AWS CloudFormati<strong>on</strong>. Leveraging a hybrid<br />

<str<strong>on</strong>g>deployment</str<strong>on</strong>g> model also simplifies your architecture as it decouples your<br />

<str<strong>on</strong>g>deployment</str<strong>on</strong>g> method so that you can choose different strategies for updating your<br />

applicati<strong>on</strong> stack.<br />

A few example scenarios are provided below. These are not exhaustive; they are<br />

meant to give you an idea <str<strong>on</strong>g>of</str<strong>on</strong>g> hybrid <str<strong>on</strong>g>deployment</str<strong>on</strong>g> approaches that you can plan for.<br />

Scenario 1: Use AWS CloudFormati<strong>on</strong> to deploy an Elastic Beanstalk applicati<strong>on</strong><br />

al<strong>on</strong>g with an AWS service integrati<strong>on</strong> such as DynamoDB, Amaz<strong>on</strong> RDS, and<br />

Amaz<strong>on</strong> S3.<br />

Page 17 <str<strong>on</strong>g>of</str<strong>on</strong>g> 23


Amaz<strong>on</strong> Web Services – Deployment Opti<strong>on</strong>s <strong>on</strong> AWS March 2015<br />

Figure 3: Reference Architecture for Scenario 1<br />

Scenario 2: Use AWS CloudFormati<strong>on</strong> to deploy similar applicati<strong>on</strong> stacks in<br />

AWS OpsWorks and manage the entire infrastructure using AWS<br />

CloudFormati<strong>on</strong>.<br />

Figure 4: Reference Architecture for Scenario 2<br />

Page 18 <str<strong>on</strong>g>of</str<strong>on</strong>g> 23


Amaz<strong>on</strong> Web Services – Deployment Opti<strong>on</strong>s <strong>on</strong> AWS March 2015<br />

Scenario 3: Use AWS CloudFormati<strong>on</strong> to deploy multiple applicati<strong>on</strong> stacks that<br />

you manage with Elastic Beanstalk and AWS OpsWorks.<br />

Figure 5: Reference Architecture for Scenario 3<br />

Scenario 4: Use AWS CodeDeploy to deploy and manage multiple applicati<strong>on</strong>s<br />

while provisi<strong>on</strong>ing the infrastructure using Amaz<strong>on</strong> EC2 and AWS<br />

CloudFormati<strong>on</strong>.<br />

Page 19 <str<strong>on</strong>g>of</str<strong>on</strong>g> 23


Amaz<strong>on</strong> Web Services – Deployment Opti<strong>on</strong>s <strong>on</strong> AWS March 2015<br />

C<strong>on</strong>clusi<strong>on</strong><br />

Figure 6: Reference Architecture for Scenario 4<br />

Amaz<strong>on</strong> Web Services provides number <str<strong>on</strong>g>of</str<strong>on</strong>g> tools to simplify and automate the<br />

provisi<strong>on</strong>ing <str<strong>on</strong>g>of</str<strong>on</strong>g> infrastructure and <str<strong>on</strong>g>deployment</str<strong>on</strong>g> <str<strong>on</strong>g>of</str<strong>on</strong>g> applicati<strong>on</strong>s. Each <str<strong>on</strong>g>deployment</str<strong>on</strong>g><br />

service has a unique approach for managing applicati<strong>on</strong> <str<strong>on</strong>g>deployment</str<strong>on</strong>g>s and <str<strong>on</strong>g>of</str<strong>on</strong>g>fers<br />

various strategies for updating your applicati<strong>on</strong>. For best results, focus <strong>on</strong> your<br />

workload and choose a <str<strong>on</strong>g>deployment</str<strong>on</strong>g> service that is tailored to your specific needs.<br />

As you plan, c<strong>on</strong>sider using hybrid <str<strong>on</strong>g>deployment</str<strong>on</strong>g> model approach, which uses a<br />

combinati<strong>on</strong> <str<strong>on</strong>g>of</str<strong>on</strong>g> <str<strong>on</strong>g>deployment</str<strong>on</strong>g> services for managing multiple applicati<strong>on</strong>s<br />

throughout their lifecycle.<br />

Page 20 <str<strong>on</strong>g>of</str<strong>on</strong>g> 23


Amaz<strong>on</strong> Web Services – Deployment Opti<strong>on</strong>s <strong>on</strong> AWS March 2015<br />

Notes<br />

1 http://<strong>aws</strong>.amaz<strong>on</strong>.com/ec2/<br />

2 http://<strong>aws</strong>.amaz<strong>on</strong>.com/ebs/<br />

3 http://<strong>aws</strong>.amaz<strong>on</strong>.com/s3/<br />

4 http://<strong>aws</strong>.amaz<strong>on</strong>.com/glacier/<br />

5 http://<strong>aws</strong>.amaz<strong>on</strong>.com/rds/<br />

6 http://<strong>aws</strong>.amaz<strong>on</strong>.com/redshift/<br />

7 http://<strong>aws</strong>.amaz<strong>on</strong>.com/dynamodb/<br />

8 http://<strong>aws</strong>.amaz<strong>on</strong>.com/kinesis/<br />

9 http://<strong>aws</strong>.amaz<strong>on</strong>.com/elasticbeanstalk/<br />

10 https://www.docker.com/<br />

11 http://<strong>aws</strong>.amaz<strong>on</strong>.com/autoscaling/<br />

12 http://<strong>aws</strong>.amaz<strong>on</strong>.com/elasticloadbalancing/<br />

13 http://<strong>aws</strong>.amaz<strong>on</strong>.com/cloudformati<strong>on</strong>/<br />

14 http://<strong>aws</strong>.amaz<strong>on</strong>.com/codedeploy/<br />

15 http://<strong>aws</strong>.amaz<strong>on</strong>.com/opsworks/<br />

16 http://<strong>aws</strong>.amaz<strong>on</strong>.com/codecommit/<br />

17 http://<strong>aws</strong>.amaz<strong>on</strong>.com/codepipeline/<br />

18 http://<strong>aws</strong>.amaz<strong>on</strong>.com/codedeploy/<br />

19 http://<strong>aws</strong>.amaz<strong>on</strong>.com/ecs/<br />

20 http://docs.<strong>aws</strong>.amaz<strong>on</strong>.com/AWSEC2/latest/UserGuide/using-networksecurity.html<br />

21 http://docs.<strong>aws</strong>.amaz<strong>on</strong>.com/AWSEC2/latest/UserGuide/iam-roles-foramaz<strong>on</strong>-ec2.html<br />

22 http://<strong>aws</strong>.amaz<strong>on</strong>.com/vpc/<br />

Page 21 <str<strong>on</strong>g>of</str<strong>on</strong>g> 23


Amaz<strong>on</strong> Web Services – Deployment Opti<strong>on</strong>s <strong>on</strong> AWS March 2015<br />

23 http://<strong>aws</strong>.amaz<strong>on</strong>.com/cloudwatch/<br />

24 https://c<strong>on</strong>sole.<strong>aws</strong>.amaz<strong>on</strong>.com/<br />

25 http://<strong>aws</strong>.amaz<strong>on</strong>.com/cli/<br />

26 http://<strong>aws</strong>.amaz<strong>on</strong>.com/tools/<br />

27<br />

http://docs.<strong>aws</strong>.amaz<strong>on</strong>.com/Amaz<strong>on</strong>CloudWatch/latest/DeveloperGuide/Wh<br />

atIsCloudWatchLogs.html<br />

28 http://<strong>aws</strong>.amaz<strong>on</strong>.com/cloudtrail/<br />

29 http://docs.<strong>aws</strong>.amaz<strong>on</strong>.com/IAM/latest/UserGuide/instance-pr<str<strong>on</strong>g>of</str<strong>on</strong>g>iles.html<br />

30 http://docs.<strong>aws</strong>.amaz<strong>on</strong>.com/AWSEC2/latest/UserGuide/using-regi<strong>on</strong>savailability-z<strong>on</strong>es.html<br />

31 http://docs.<strong>aws</strong>.amaz<strong>on</strong>.com/elasticbeanstalk/latest/dg/customizec<strong>on</strong>tainers.html<br />

32 http://docs.<strong>aws</strong>.amaz<strong>on</strong>.com/opsworks/latest/userguide/other-services.html<br />

33<br />

http://docs.<strong>aws</strong>.amaz<strong>on</strong>.com/AWSCloudFormati<strong>on</strong>/latest/UserGuide/CHAP_<br />

TemplateQuickRef.html<br />

34 http://docs.<strong>aws</strong>.amaz<strong>on</strong>.com/<strong>aws</strong>accountbilling/latest/aboutv2/allocati<strong>on</strong>.html<br />

35 http://docs.<strong>aws</strong>.amaz<strong>on</strong>.com/AWSEC2/latest/UserGuide/AMIs.html<br />

36 https://s3.amaz<strong>on</strong><strong>aws</strong>.com/cloudformati<strong>on</strong>examples/BoostrappingApplicati<strong>on</strong>sWithAWSCloudFormati<strong>on</strong>.pdf<br />

37 https://www.packer.io/<br />

38 https://github.com/Netflix/aminator<br />

39<br />

http://docs.<strong>aws</strong>.amaz<strong>on</strong>.com/AWSEC2/latest/UserGuide/Using_Tags.html#U<br />

sing_Tags_C<strong>on</strong>sole<br />

Page 22 <str<strong>on</strong>g>of</str<strong>on</strong>g> 23


Amaz<strong>on</strong> Web Services – Deployment Opti<strong>on</strong>s <strong>on</strong> AWS March 2015<br />

40 http://docs.<strong>aws</strong>.amaz<strong>on</strong>.com/codedeploy/latest/userguide/auto-scalinginteg.html<br />

41 http://<strong>aws</strong>.amaz<strong>on</strong>.com/codedeploy/product-integrati<strong>on</strong>s/<br />

43<br />

42 http://d0.<strong>aws</strong>static.com/whitepapers/managing-multi-tiered-webapplicati<strong>on</strong>s-with-opsworks.pdf<br />

http://docs.<strong>aws</strong>.amaz<strong>on</strong>.com/AutoScaling/latest/DeveloperGuide/AutoScaling<br />

Behavior.InstanceTerminati<strong>on</strong>.html<br />

44 http://docs.<strong>aws</strong>.amaz<strong>on</strong>.com/elasticbeanstalk/latest/dg/usingfeatures.rollingupdates.html<br />

45 http://docs.<strong>aws</strong>.amaz<strong>on</strong>.com/AWSCloudFormati<strong>on</strong>/latest/UserGuide/<strong>aws</strong>attribute-updatepolicy.html<br />

46 http://<strong>aws</strong>.amaz<strong>on</strong>.com/route53/<br />

47 http://<strong>aws</strong>.amaz<strong>on</strong>.com/elasticache/<br />

49<br />

50<br />

48 http://docs.<strong>aws</strong>.amaz<strong>on</strong>.com/elasticbeanstalk/latest/dg/usingfeatures.CNAMESwap.html<br />

https://docs.<strong>aws</strong>.amaz<strong>on</strong>.com/AWSCloudFormati<strong>on</strong>/latest/UserGuide/protect<br />

-stack-resources.html<br />

http://docs.<strong>aws</strong>.amaz<strong>on</strong>.com/ElasticLoadBalancing/latest/DeveloperGuide/co<br />

nfig-c<strong>on</strong>n-drain.html<br />

51 http://docs.<strong>aws</strong>.amaz<strong>on</strong>.com/Route53/latest/DeveloperGuide/routingpolicy.html#routing-policy-weighted<br />

Page 23 <str<strong>on</strong>g>of</str<strong>on</strong>g> 23

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!