application lifecycle management and event driven programming on aws

68
Application Lifecycle Management and Event Driven Programming Version 1.0 Shiva N ([email protected] ) AWS Solution Architect

Upload: shiva-narayanaswamy

Post on 07-Jan-2017

691 views

Category:

Internet


0 download

TRANSCRIPT

Page 1: Application Lifecycle Management and Event Driven Programming on AWS

Application Lifecycle Management and Event

Driven Programming

Version 1.0

Shiva N ([email protected])AWS Solution Architect

Page 2: Application Lifecycle Management and Event Driven Programming on AWS

v

Application Lifecycle Management

Page 3: Application Lifecycle Management and Event Driven Programming on AWS

v

Continuous process of managing the life of an application.

ALM | What is it?

Page 4: Application Lifecycle Management and Event Driven Programming on AWS

v

Continuous process of managing the life of an application.

Change Automated In Stages Repeatable

ALM | What is it?

Page 5: Application Lifecycle Management and Event Driven Programming on AWS

v

Versions Interfaces Repository Authorization Rollforward-Rollback

ALM | What is it?

Continuous process of managing the life of an application.

Page 6: Application Lifecycle Management and Event Driven Programming on AWS

v

Entire time during which an organization spends money on it.

Developer’s laptop to production

ALM | What is it?

Continuous process of managing the life of an application.

Page 7: Application Lifecycle Management and Event Driven Programming on AWS

v

How long does it take for a single line of code change to move to production?

ALM | Why?

Page 8: Application Lifecycle Management and Event Driven Programming on AWS

v

ALM | Why?

Business Idea

Implementation

Testing

Release

Customer Feedback

Innovation Revolution

Page 9: Application Lifecycle Management and Event Driven Programming on AWS

v

ALM | Why?

Innovation requires two things: the ability to try a lot

of experiments, and not having to live with the

collateral damage of failed experiments

Andy JassySVP, Amazon Web Services

Business Idea

Implementation

Testing

Release

Customer Feedback

Innovation Revolution

Page 10: Application Lifecycle Management and Event Driven Programming on AWS

v

ALM | The landscape

Page 11: Application Lifecycle Management and Event Driven Programming on AWS

v

Processes Tools

ALM | This presentation will focus on

Page 12: Application Lifecycle Management and Event Driven Programming on AWS

v

Version Control CI Server

Package Builder

Deploy ServerCommit to

Git/masterDev

Get / PullCode

AMIs

Distributed BuildsRun Tests in parallel

Staging Env

Test Env

CodeConfigTests

Prod Env

Push

Config InstallCreate

Repo

CloudFormation Templates for Env

Generate

ALM | Sample Application Cycle

Page 13: Application Lifecycle Management and Event Driven Programming on AWS

v

Version Control CI Server

Package Builder

Deploy ServerCommit to

Git/masterDev

Get / PullCode

AMIs

Send Build Report to DevStop everything if build failed

Distributed BuildsRun Tests in parallel

Staging Env

Test Env

CodeConfigTests

Prod Env

Push

Config InstallCreate

Repo

CloudFormation Templates for Env

Generate

ALM | Continuous Integration

Page 14: Application Lifecycle Management and Event Driven Programming on AWS

v• Test driven promotion (of development change)• Increasing velocity of feedback cycle through iterative change• Contain change to reduce risk• Bugs are detected quickly• Automated testing reduces size of testing effort

ALM | Why CI?

Page 15: Application Lifecycle Management and Event Driven Programming on AWS

v

Version Control CI Server

Package Builder

Deploy ServerCommit to

Git/masterDev

Get / PullCode

AMIs

Send Build Report to DevStop everything if build failed

Distributed BuildsRun Tests in parallel

Staging Env

Test Env

CodeConfigTests

Prod Env

Push

Config InstallCreate

Repo

CloudFormation Templates for Env

Generate

ALM | Continuous Delivery/Deployment

Page 16: Application Lifecycle Management and Event Driven Programming on AWS

v

• Automated, repeatable process to push changes to production• Hardens, de-risks the deployment process• Immediate feedback from users• Supports A/B testing or “We test customer reactions to features in

production”• Gives us a breadth of data points across our applications

ALM | Why CD?

Page 17: Application Lifecycle Management and Event Driven Programming on AWS

SOURCE CODE REPOSITORY

DNS

CONTINUOUS INTEGRATION SERVER

PROJECT MANAGEMENT SERVER

BUILDS

ALM | Sample CI-CD architecture

Page 18: Application Lifecycle Management and Event Driven Programming on AWS

v

18

MonitorProvisionDeployTestBuildCode

AWS Elastic Beanstalk

AWS OpsWorks

CloudWatchCloudFormationCodeDeploy

CodeCommit CodePipeline

ALM | AWS Services

AWS Elastic Container Service

Page 19: Application Lifecycle Management and Event Driven Programming on AWS

v

ALM | CodeCommit

• Fully managed service source control service for hosting private Git repositories

• Automatically scales to meet the needs of your project and stores any type of file (source, images, videos, libraries etc.) with no limit on repository size.

• Fully integrated with AWS CodePipeline and AWS CodeDeploy to streamline development.

Dev Source Control Continuous Integration

Continuous Delivery

Page 20: Application Lifecycle Management and Event Driven Programming on AWS

v

ALM | CodeCommit

Dev Source Control Continuous Integration

Continuous Delivery

• Efficient - transfers incremental changes

• AWS CodeCommit supports all Git commands and works with your existing Git-based tools (e.g., continuous integration/continuous delivery systems, and graphical clients)

• Fully integrated with AWS Identity and Access Management (IAM)

Page 21: Application Lifecycle Management and Event Driven Programming on AWS

v

ALM | CodePipeline

• A continuous delivery and release automation service that aids smooth deployments.

• You can design your development workflow for checking in code, building the code, deploying your application into staging, testing it, and releasing it to production

Dev Source Control Continuous Integration

Continuous Delivery

Page 22: Application Lifecycle Management and Event Driven Programming on AWS

v

ALM | CodePipeline

• CodePipeline standardizes and automates the software release process, allowing you to rapidly release new features to users

• Provides the capability to set up configurable gates between each stage such as time-based rules or manual approvals

• Workflows can be created to run unit and integration tests before deploying to production

Dev Source Control Continuous Integration

Continuous Delivery

Page 23: Application Lifecycle Management and Event Driven Programming on AWS

v

ALM | CodeDeploy

• Automates code deployments to Amazon EC2 instances.

• Makes it easier to rapidly release new features, helps avoid downtime during deployment, and handles the complexity of updating applications

Dev Source Control Continuous Integration

Continuous Delivery

Page 24: Application Lifecycle Management and Event Driven Programming on AWS

v

ALM | CodeDeploy

• Deploys your released code to a fleet of EC2 instances, Autoscaling group, or On-Prem hosts.

• Accommodate fleets that range in size from one instance all the way up to tens of thousands of instances

• Automatically schedules updates across multiple Availability Zones in order to maintain high availability during the deployment

Dev Source Control Continuous Integration

Continuous Delivery

Page 25: Application Lifecycle Management and Event Driven Programming on AWS

CODECOMMIT

DNS

CODEPIPELINE

PROJECT MANAGEMENT SERVER

BUILDS

CODEDEPLOY

Page 26: Application Lifecycle Management and Event Driven Programming on AWS

v

Options for deploying workloads on AWS

Tools deployment

Platformdeployment(PaaS)

Manual deployment(Console/CLI)

Code in-placeContainer image (Docker)

Page 27: Application Lifecycle Management and Event Driven Programming on AWS

v

27

MonitorProvisionDeployTestBuildCode

AWS Elastic Beanstalk

AWS OpsWorks

CloudWatchCloudFormationCodeDeploy

CodeCommit CodePipeline

ALM | AWS Services

AWS Elastic Container Service

Page 28: Application Lifecycle Management and Event Driven Programming on AWS

v

What are we deploying?How much control do we want?

Page 29: Application Lifecycle Management and Event Driven Programming on AWS

v• Unified command line-based

tool to manage your AWS services

• Control multiple AWS services from the command line and automate them through scripts

ALM | Automate with AWS CLI

Page 30: Application Lifecycle Management and Event Driven Programming on AWS

v

ALM | Automate with AWS CLI

Page 31: Application Lifecycle Management and Event Driven Programming on AWS

v

Infrastructure as Code

Integrates with version control

JSON format

Templates

Stacks

Supports all AWS resource typesAWS CloudFormation

ALM | Cloudformation

Page 32: Application Lifecycle Management and Event Driven Programming on AWS

v

{"Description" : "Create an EC2 instance running the Amazon Linux 32 bit AMI.”,"Parameters" : {

"KeyPair" : { "Description" : "The EC2 Key Pair to allow SSH access to the instance", "Type" : "String"

} },"Resources" : {

"Ec2Instance" : { "Type" : "AWS::EC2::Instance", "Properties" : {

"KeyName" : { "Ref" : "KeyPair" }, "ImageId" : "ami-75g0061f”,“InstanceType” : “m1.medium”

} }

}, "Outputs" : {

"InstanceId" : { "Description" : "The InstanceId of the newly created EC2 instance", "Value" : { "Ref" : "Ec2Instance” }

} }

}

Architecting on AWS – Overview of Services for Web Applications

ALM | Cloudformation

Page 33: Application Lifecycle Management and Event Driven Programming on AWS

v

Architecting on AWS – Overview of Services for Web Applications

Template File Defining Stack

GitSubversionMercurial

Dev

Test

Prod

The entire application can be represented in an AWS CloudFormation template.

Use the version control system of your choice to store and track changes to this template

Build out multiple environments, such as for Development, Test, and Production using the template

ALM | Cloudformation

Page 34: Application Lifecycle Management and Event Driven Programming on AWS

v• AWS OpsWorks makes it easy to deploy

& operate apps of all shapes and sizes

• Define configurations for your entire environment in a format that you can maintain and version just like your application source code

• Uses the Chef framework so you can bring your own recipes or leverage 100’s of community-built configurations

ALM | Opsworks

Page 35: Application Lifecycle Management and Event Driven Programming on AWS

v• Quickly deploy and manage applications

in the AWS cloud without worrying about the application infrastructure

• True PaaS – automatically handles allthe details of resource provisioning,load balancing & auto-scaling

• Launch your Java, PHP, .NET, Node.js, Python, and Ruby applications in a matter of minutes

ALM | Beanstalk

Page 36: Application Lifecycle Management and Event Driven Programming on AWS

v• Cluster Management Made Easy

• Flexible scheduling

• High Performance

• Resource Efficiency

• Programmatic Control

• Docker Compatibility

ALM | Elastic Container Service

Page 37: Application Lifecycle Management and Event Driven Programming on AWS

v

WWW server

WWW server

WWW server

WWW server

Logging Service

PayService

ProcessService

ProcessService

ProcessService

ProcessService

Cluster of underlyingEC2 instances

WWW containers Application-specific microservices

WWW server

WWW server

Scale out at the

container level

Launching containers is in the order of seconds – very fast to react

ALM | Elastic Container Service

Page 38: Application Lifecycle Management and Event Driven Programming on AWS

v• Deploy in place • Deploy all at once (Service outage)• Rolling updates

• Blue-Green Deployment• Discrete environment

• Multiple environments from branches• Support A/B testing• “Rolling DNS”

• Alternate Blue-Green (Red-Black?) deployment• Alternate auto scaling group• Avoid messing with DNS

ALM | Deployment Approaches

Page 39: Application Lifecycle Management and Event Driven Programming on AWS

v

CodeDeploy

ALM | Deploy in place – Rolling update

ELB

S3

EC2

Page 40: Application Lifecycle Management and Event Driven Programming on AWS

v

ALM | Deploy in place – Rolling update

Page 41: Application Lifecycle Management and Event Driven Programming on AWS

v

ALM | Deploy in place – Rolling update

Page 42: Application Lifecycle Management and Event Driven Programming on AWS

v

ALM | Deploy in place – Rolling update

Page 43: Application Lifecycle Management and Event Driven Programming on AWS

v

ALM | Deploy in place – Rolling update

Page 44: Application Lifecycle Management and Event Driven Programming on AWS

v

ALM | Deploy in place – Rolling update

Page 45: Application Lifecycle Management and Event Driven Programming on AWS

vAmazon Route 53

EC2 Instances

ELB

100%

DynamoDB MySQL RDSInstance

ElastiCache Cache Node

ALM | Blue-Green Deployment

Page 46: Application Lifecycle Management and Event Driven Programming on AWS

v

Amazon Route 53

EC2 Instances

ELB

EC2 Instances

ELB

100%UAT

DynamoDB MySQL RDSInstance

ElastiCache Cache Node

ALM | Blue-Green Deployment

Page 47: Application Lifecycle Management and Event Driven Programming on AWS

v

Amazon Route 53

EC2 Instances

ELB

EC2 Instances

ELB

90% 10%

DynamoDB MySQL RDSInstance

ElastiCache Cache Node

ALM | Blue-Green Deployment

Page 48: Application Lifecycle Management and Event Driven Programming on AWS

vAmazon Route 53

EC2 Instances

ELB

EC2 Instances

ELB

50% 50%

DynamoDB MySQL RDSInstance

ElastiCache Cache Node

ALM | Blue-Green Deployment

Page 49: Application Lifecycle Management and Event Driven Programming on AWS

vAmazon Route 53

EC2 Instances

ELB

EC2 Instances

ELB

0% 100%

DynamoDB MySQL RDSInstance

ElastiCache Cache Node

ALM | Blue-Green Deployment

Page 50: Application Lifecycle Management and Event Driven Programming on AWS

vAmazon Route 53

EC2 Instances

ELB

EC2 Instances

ELB

0% 100%

DynamoDB MySQL RDSInstance

ElastiCache Cache Node

ALM | Blue-Green Deployment

Page 51: Application Lifecycle Management and Event Driven Programming on AWS

v

Auto Scaling Group

V1

ELB

Amazon Relational

Database Service (RDS)

ALM | Red-Black Deployment

Page 52: Application Lifecycle Management and Event Driven Programming on AWS

v

Auto Scaling Group

V1

Auto Scaling Group

V2

ELB

Amazon Relational

Database Service (RDS)

UAT

ALM | Red-Black Deployment

Page 53: Application Lifecycle Management and Event Driven Programming on AWS

v

Auto Scaling Group

V1

Auto Scaling Group

V2

ELB

Amazon Relational

Database Service (RDS)

ALM | Red-Black Deployment

Page 54: Application Lifecycle Management and Event Driven Programming on AWS

v

Auto Scaling Group

V2

ELB

Amazon Relational

Database Service (RDS)

ALM | Red-Black Deployment

Page 55: Application Lifecycle Management and Event Driven Programming on AWS
Page 56: Application Lifecycle Management and Event Driven Programming on AWS

v

Event Driven Programming

Page 57: Application Lifecycle Management and Event Driven Programming on AWS

v

EDP | What is Event driven architecture?

A software architecture where loosly coupled components communicate with each other by triggering events

Page 58: Application Lifecycle Management and Event Driven Programming on AWS

v

Type of interaction Time driven Request driven Event driven

Initiator Time Client Even

Participants The specified systems Client and Server Open ended

Example

EDP | Three styles of interaction

Fruit system

Run inventory every hour

Fruit system

Me want 5 bananas

Fruit system

Monkey took 5 bananas

Page 59: Application Lifecycle Management and Event Driven Programming on AWS

v

• Real time (or near real time)• Push notifications• One-way ‘fire-and-forget’• Immediate action at event consumer• Informational (“monkey took bananas”) and not commands (“perform

banana inventory”)

EDP| 5 characteristics

Page 60: Application Lifecycle Management and Event Driven Programming on AWS

v• “Stored procedures for the cloud”• A zero-administration compute platform• Just the code without needing to define

the underlying compute resources or OS• Asynchronous functions • Event driven from other services• …Or triggered externally and even chained

AWS Lambda: connective tissue for AWS services

All you need is code™

EDP | Event Driven Compute – AWS Lambda

Page 61: Application Lifecycle Management and Event Driven Programming on AWS

No Infrastructure to Manage• Focus on business logic, not

infrastructure• Customer uploads code; AWS

Lambda handles• Capacity• Scaling• Deployment• Fault tolerance• Monitoring• Logging• Web service front end• Security patching

EDP | AWS Lambda

Page 62: Application Lifecycle Management and Event Driven Programming on AWS

Automatic scaling• Customers can’t over or under

provision• Customers pay only for what

they use• E.g. Each object uploaded to

Amazon S3 is an event• Each event becomes a Lambda

request (hands free delivery)• Lambda scales to match the

event rate

EDP | AWS Lambda

Page 63: Application Lifecycle Management and Event Driven Programming on AWS

Bring your own code (BYOC)

• Create threads and processes, run batch scripts or other executables, and read/write files in /tmp.

• Include any library with a Lambda function code, even native libraries.

EDP | AWS Lambda

Page 64: Application Lifecycle Management and Event Driven Programming on AWS

Fine-grained pricing• Price compute time by

100ms, so even short jobs make sense

• Low request charge• No hourly, daily, or

monthly minimums• Free tier

EDP | AWS Lambda

Page 65: Application Lifecycle Management and Event Driven Programming on AWS

v

• AWS Service Integration• Event triggers from Amazon S3,

DynamoDB, and Kinesis events• Compute at any scale

• One request a month or 10,000 parallel invocations

• Simple, stateless approach, expressed in conventional languages

• Fast response• No long delays for provisioning,

deployment or scale-up• Change and run code as fast as you can type

• Never pay for idle • Fine-grained pricing in 100ms, 64MB steps• Economical at any scale

AWS Lambda

AWS Event Integration

S3 Handler

Dynamo

Handler

Kinesis Handler

Custom Invoke

API

App Event

Handler

EDP | AWS Lambda – Key Features

Page 66: Application Lifecycle Management and Event Driven Programming on AWS

v

OR

1

2

3

4

1

2

3

EDP | Photo album application architecture

Page 67: Application Lifecycle Management and Event Driven Programming on AWS

v

On premises AWS EC2 AWS ECS AWS Lambda

Weeks Minutes Seconds Milliseconds

EDP | AWS Lambda

Page 68: Application Lifecycle Management and Event Driven Programming on AWS

v