Sascha Möllering | zanox AG
Cloud Workshop
About me
Sascha Möllering
sascha@autoscaling.io
Lead Engineer / DevOps Hipster
zanox AG
http://autoscaling.io
@sascha242
About me
Java Magazin 11.14
Architektur im Kontext der Cloud: Patterns und
Best Practices
AWS Virtual Cloud Summit
Continuous delivery in AWS using Docker
http://aws-summit.de/
Entwickler Spezial: Docker
Über den Wolken: Ein Erfahrungsbericht zum
Docker-Einsatz in der Amazon Cloud
Agenda
• AWS Overview
• Creating a cloud service
• Real World example
• Cloud deployment
• Q&A
How can we scale?
RegionUS-WEST (N.
California) EU-WEST (Ireland)
ASIA PAC
(Tokyo)
ASIA PAC
(Singapore)
US-WEST (Oregon)
SOUTH AMERICA (Sao
Paulo)
US-EAST (Virginia)
GOV CLOUD
ASIA PAC
(Sydney)
Regions
Regions
EU-CENTRAL
(Frankfurt)
AWS Overview
Zones
Zones
Availability
Zone
AWS Overview
AWS Overview
EC2: Resizable compute capacity
AutoScaling: scale up or down
Route 53: Domain Name System
ELB: Load Balancing
Elastic IP: Static IP address
AWS Overview
RDS: Managed database service
DynamoDB: NoSQL implementation
Redshift: data warehouse solution
ElastiCache: Managed cache
Kinesis: Service for streaming data
AWS Overview
S3: Highly-scalable object storage
CloudFront: CDN implementation
CloudWatch: Monitoring service
IAM: Identity and Access Management
EMR: Managed Hadoop
CloudFormation: Configuration Mgmt
Starting point
• How can we leverage the Cloud?
• Our application:
– Simple Java based web application
– One application
– One database
– Runs in our own DC
Creating a cloud service
• Initial setup:
– Route53 for DNS
– One Elastic IP (static IPs for the Cloud)
– One EC2 instance
• Web Application
• Database
– One AZ
Creating a cloud service
Availability Zone
Creating a cloud service
• Simple approach to scale:
– Different EC2 instance type
• More RAM
• More CPU power
• More IOPS
• Approach will hit a barrier
Creating a cloud service
• Problems:
– No failover
– No redundancy
– Database and application on one instance
– Does not scale very well
Creating a cloud service
• Separate Web Application from DB
– One EC2 instance for the Web Application
– One EC2 instance for the DB
– Or: Managed DB service (RDS)
• One AZ
Creating a cloud service
Availability Zone
Database
Creating a cloud service
• Problems:
– No failover
– No redundancy
– Does still not scale very well
Creating a cloud service
• Add an ELB
• Add EC2 instance for Web Application
• Different AZs
• Standby DB instance
– Multi AZ setup in RDS
Creating a cloud service
Creating a cloud service
Availability Zone
Database
Availability Zone
Database
Creating a cloud service
• Problems:
– Still limited scaling capabilities
– If one EC2 instance crashes, 50% less
capability
Creating a cloud service
• Add additional EC2 instances
• Add read replicas in RDS
Creating a cloud service
Availability Zone
Database
Availability Zone
Database
Creating a cloud service
• Problems:
– Naive implementation
– Does not leverage AWS services
– Limited scaling
– Can be quite expensive
Creating a cloud service
• Refactoring
• Introduce caches to take load from DB
• Use S3 and CloudFront to ship static
content
• Store session data in DynamoDB
• Add Autoscaling
Creating a cloud service
• Autoscaling
– Automatic resizing of compute clusters
based on demand
– Integrated to Amazon CloudWatch
– Maximum and minimum pool sizes
– Autoscaling policies triggered by
CloudWatch alarms
Creating a cloud service
Requests
Elastic Load Balancing
Latency Metrics CPU Metrics
Amazon CloudWatch
Metric
Monitoring
Alarm
Notification
Scale up/down
Creating a cloud service
Availability Zone
Auto Scaling
group
Creating a cloud service
• Started with a simple web application
• Added several Amazon services
• Managed to shift load from application
to services
• Added caches and CDN
• Added Autoscaling
Creating a cloud service
• Next steps:
– SOA/Microservices
– Loose coupling: decouple interactions
– Amazon services, don‘t reinvent the wheel
– Database federation
– Database sharding
Docker Deployment
• Amazon Services with Docker
support:
–Amazon OpsWorks*
–Elastic Beanstalk
–EC2 Container Service
*by adding a custom Docker Layer
Docker Deployment
• On EC2 level:
– Using the Docker remote API
– EC2 User Data
Docker Deployment
• Remote API
– API to access Docker daemon
– Can be bound to specific host/port
– E.g. Jenkins can trigger deployments
– GET /containers/json
Docker Deployment
• EC2 User Data
– Data to configure instance during launch
• Install Docker
• Start Daemon
• Run Docker container
Demo
• Elastic architecture that grows and
shrinks
• Multiple AZs
• Use case: simple web app
• Elastic Beanstalk and Docker
• Postgres RDS DB
Demo
• JHipster
– Yeoman generator
– Yeoman is a scaffolding tool for webapps
– Creates Spring Boot/AngularJS projects
Demo
• Support for:
– Maven/Gradle
– Spring Security
– Spring Data JPA
– Elasticsearch
– MongoDB
– Cassandra
– ...
Demo
Demo
Elastic Beanstalk
• Docker support:
– Dockerrun.aws.json specifies runtime
– Dockerfile is an alternative
• EC2 instances using Docker 1.6
• No direct port mapping
• Local nginx reverse proxy
• Connects to IP of Docker container
Elastic Beanstalk
• Dockerrun.aws.json:
– Specifies Docker image (support for private
registries as well)
– Defines port for local nginx
– Support for volumes and logging as well
Elastic Beanstalk
Elastic Beanstalk
But … we didn’t
specify RDS
connection strings in
our Container?
• RDS specific values are exposed as
ENV-variables
• Mapped into the Docker container
• Used by the application to connect to
Postgres
Elastic Beanstalk
Elastic Beanstalk
Elastic Beanstalk
• nginx local proxy
• Config in sites-enabled and conf.d
• proxy-pass is http://docker
• Maps to container-ip
Elastic Beanstalk
Elastic Beanstalk
Elastic Beanstalk
Q&A

DevOpsCon Cloud Workshop

  • 1.
    Sascha Möllering |zanox AG Cloud Workshop
  • 2.
    About me Sascha Möllering sascha@autoscaling.io LeadEngineer / DevOps Hipster zanox AG http://autoscaling.io @sascha242
  • 3.
    About me Java Magazin11.14 Architektur im Kontext der Cloud: Patterns und Best Practices AWS Virtual Cloud Summit Continuous delivery in AWS using Docker http://aws-summit.de/ Entwickler Spezial: Docker Über den Wolken: Ein Erfahrungsbericht zum Docker-Einsatz in der Amazon Cloud
  • 4.
    Agenda • AWS Overview •Creating a cloud service • Real World example • Cloud deployment • Q&A
  • 5.
    How can wescale?
  • 6.
    RegionUS-WEST (N. California) EU-WEST(Ireland) ASIA PAC (Tokyo) ASIA PAC (Singapore) US-WEST (Oregon) SOUTH AMERICA (Sao Paulo) US-EAST (Virginia) GOV CLOUD ASIA PAC (Sydney) Regions Regions EU-CENTRAL (Frankfurt) AWS Overview
  • 7.
  • 8.
    AWS Overview EC2: Resizablecompute capacity AutoScaling: scale up or down Route 53: Domain Name System ELB: Load Balancing Elastic IP: Static IP address
  • 9.
    AWS Overview RDS: Manageddatabase service DynamoDB: NoSQL implementation Redshift: data warehouse solution ElastiCache: Managed cache Kinesis: Service for streaming data
  • 10.
    AWS Overview S3: Highly-scalableobject storage CloudFront: CDN implementation CloudWatch: Monitoring service IAM: Identity and Access Management EMR: Managed Hadoop CloudFormation: Configuration Mgmt
  • 11.
    Starting point • Howcan we leverage the Cloud? • Our application: – Simple Java based web application – One application – One database – Runs in our own DC
  • 12.
    Creating a cloudservice • Initial setup: – Route53 for DNS – One Elastic IP (static IPs for the Cloud) – One EC2 instance • Web Application • Database – One AZ
  • 13.
    Creating a cloudservice Availability Zone
  • 14.
    Creating a cloudservice • Simple approach to scale: – Different EC2 instance type • More RAM • More CPU power • More IOPS • Approach will hit a barrier
  • 15.
    Creating a cloudservice • Problems: – No failover – No redundancy – Database and application on one instance – Does not scale very well
  • 16.
    Creating a cloudservice • Separate Web Application from DB – One EC2 instance for the Web Application – One EC2 instance for the DB – Or: Managed DB service (RDS) • One AZ
  • 17.
    Creating a cloudservice Availability Zone Database
  • 18.
    Creating a cloudservice • Problems: – No failover – No redundancy – Does still not scale very well
  • 19.
    Creating a cloudservice • Add an ELB • Add EC2 instance for Web Application • Different AZs • Standby DB instance – Multi AZ setup in RDS
  • 20.
  • 21.
    Creating a cloudservice Availability Zone Database Availability Zone Database
  • 22.
    Creating a cloudservice • Problems: – Still limited scaling capabilities – If one EC2 instance crashes, 50% less capability
  • 23.
    Creating a cloudservice • Add additional EC2 instances • Add read replicas in RDS
  • 24.
    Creating a cloudservice Availability Zone Database Availability Zone Database
  • 25.
    Creating a cloudservice • Problems: – Naive implementation – Does not leverage AWS services – Limited scaling – Can be quite expensive
  • 26.
    Creating a cloudservice • Refactoring • Introduce caches to take load from DB • Use S3 and CloudFront to ship static content • Store session data in DynamoDB • Add Autoscaling
  • 27.
    Creating a cloudservice • Autoscaling – Automatic resizing of compute clusters based on demand – Integrated to Amazon CloudWatch – Maximum and minimum pool sizes – Autoscaling policies triggered by CloudWatch alarms
  • 28.
    Creating a cloudservice Requests Elastic Load Balancing Latency Metrics CPU Metrics Amazon CloudWatch Metric Monitoring Alarm Notification Scale up/down
  • 29.
    Creating a cloudservice Availability Zone Auto Scaling group
  • 30.
    Creating a cloudservice • Started with a simple web application • Added several Amazon services • Managed to shift load from application to services • Added caches and CDN • Added Autoscaling
  • 31.
    Creating a cloudservice • Next steps: – SOA/Microservices – Loose coupling: decouple interactions – Amazon services, don‘t reinvent the wheel – Database federation – Database sharding
  • 33.
    Docker Deployment • AmazonServices with Docker support: –Amazon OpsWorks* –Elastic Beanstalk –EC2 Container Service *by adding a custom Docker Layer
  • 34.
    Docker Deployment • OnEC2 level: – Using the Docker remote API – EC2 User Data
  • 35.
    Docker Deployment • RemoteAPI – API to access Docker daemon – Can be bound to specific host/port – E.g. Jenkins can trigger deployments – GET /containers/json
  • 36.
    Docker Deployment • EC2User Data – Data to configure instance during launch • Install Docker • Start Daemon • Run Docker container
  • 37.
    Demo • Elastic architecturethat grows and shrinks • Multiple AZs • Use case: simple web app • Elastic Beanstalk and Docker • Postgres RDS DB
  • 38.
  • 39.
    • JHipster – Yeomangenerator – Yeoman is a scaffolding tool for webapps – Creates Spring Boot/AngularJS projects Demo
  • 40.
    • Support for: –Maven/Gradle – Spring Security – Spring Data JPA – Elasticsearch – MongoDB – Cassandra – ... Demo
  • 42.
  • 51.
    Elastic Beanstalk • Dockersupport: – Dockerrun.aws.json specifies runtime – Dockerfile is an alternative • EC2 instances using Docker 1.6 • No direct port mapping • Local nginx reverse proxy • Connects to IP of Docker container
  • 52.
    Elastic Beanstalk • Dockerrun.aws.json: –Specifies Docker image (support for private registries as well) – Defines port for local nginx – Support for volumes and logging as well
  • 53.
  • 54.
    Elastic Beanstalk But …we didn’t specify RDS connection strings in our Container?
  • 55.
    • RDS specificvalues are exposed as ENV-variables • Mapped into the Docker container • Used by the application to connect to Postgres Elastic Beanstalk
  • 56.
  • 57.
    Elastic Beanstalk • nginxlocal proxy • Config in sites-enabled and conf.d • proxy-pass is http://docker • Maps to container-ip
  • 58.
  • 59.
  • 60.
  • 61.

Editor's Notes

  • #6 Frage: wie können wir Skalieren? AWS als Basis Zeige heute: Patterns und Best Practices in der Cloud anhand von AWS Beispielapplikation in Java, die skaliert werden soll
  • #7 9 bzw. 10 verschiedene Regionen Region: separierte geographische Bereiche Neu: EU-Central in Frankfurt
  • #8 Regions werden in Availability Zones unterteilt Jede AZ is isoliert, aber durch Leitungen mit niedriger Latenz verbunden A group of AZ is a Region A group of Datacenter is an AZ
  • #14 Elastic IP addresses are static IP addresses designed for dynamic cloud computing. An Elastic IP address is associated with your account, not a particular instance, and you control that address until you choose to explicitly release it Im Fehlerfall (EC2-Instanz ist down) kann die EIP umgemappt werden
  • #18 RDS: fully managed database service Supports: MySQL, Oracle, Microsoft SQL Server, PostgreSQL automatically patches the database software and backs up your database
  • #20 - Multi AZ: Multi-AZ deployment option you can run mission critical workloads with high availability and built-in automated fail-over from your primary database to a synchronously replicated secondary database
  • #21 - Multi AZ: Multi-AZ deployment option you can run mission critical workloads with high availability and built-in automated fail-over from your primary database to a synchronously replicated secondary database
  • #28 - Minimum poolsizes is great if you have crashing EC2 instances,
  • #32 Alle Bestandteile der Applikation in Services auslagern, die unabhängig voneinander skaliert werden können Loose Kopplung der Komponenten über Messaging Systeme
  • #34 Eb - Single Container - Multiple Containers (dependencies using JSON format) - Cool: direct integration into ELB (not just on EC2 level)
  • #35 Eb - Single Container - Multiple Containers (dependencies using JSON format) - Cool: direct integration into ELB (not just on EC2 level)
  • #36 Eb - Single Container - Multiple Containers (dependencies using JSON format) - Cool: direct integration into ELB (not just on EC2 level)
  • #37 Eb - Single Container - Multiple Containers (dependencies using JSON format) - Cool: direct integration into ELB (not just on EC2 level)