19.10.11 Amazon Elastic Beanstalk
A Short History of AWS Amazon started as an ECommerce startup Original architecture was restructured to be more scalable and easier to maintain Competitive pressure for time-to-market Engineers still spend 70% of their time on > Scalability > Infrastructure issues > Ensuring enough computing capacity is available Must increase productivity! Solution: Define a scalable universal computing platform (Virtual) machines are the least common denominator and thus AWS (Amazon Web Services) was created! 19.10.11
What is AWS? A set of offerings Mostly IaaS (infrastructure as a Service) Very scalable Lots of customers Foundation for a lot of other cloud services Each day AWS adds the equivalent server capacity to power Amazon when it was a globale, $2.76B enterprise (about 2000) 19.10.11 3
AWS: Global Service AWS offers services globally Distributed in Regions > US-East > US-West > EU-West > Asia Pacific (Singapore) > Asia Pacific (Tokyo) > Low latency for the customer Each Region has several Availability Zones > Data center > Isolated from each other > High availability by distribution across Availability Zones SLA: Failure of one Availability Zone is acceptable 19.10.11 4
AWS Services: EC2 Elastic Computing Cloud i.e. virtual machines Can be spun up quickly (minutes) Can scale up by booting up more machines Access using ssh (Key Pairs) Firewalling / port filtering (Security Groups) IP address can be dynamically assigned to an instance (Elastic IP) Usually boot from AMIs (Amazon Machine Images) > Several available from Amazon > Others provided by the community > E.g. http://alestic.com for Ubuntu > Can create your own 19.10.11 5
AWS Services: S3 (Simple Storage Service) Storage for large files (1 byte to 5 TB) Public / private access Organized in buckets Folders etc also possible Can be downloaded using HTTP REST / SOAP interface available 99.999999999% durability and 99.99% availability of objects over a given year Sustain the concurrent loss of data in two facilities Reduced Redundancy Storage (RRS) 99.99% durability and 99.99% availability 19.10.11 6
EBS (Elastic Block Storage) Behave like raw, unformatted block devices (i.e. hard disks) Located in a specific Availability Zone Snapshots can be stored in S3 More reliable then physical hard disks EC2 usually uses EBS to store data EC2 also has local storage > Won t survive restarts > Less performance 19.10.11 7
Elastic Load Balancer Load Balancer in one Availability Zone or across Availability Zones Can detect health of EC2 instances Support sticky sessions SSL termination Supports High Availability across Availability Zones Auto Scaling: Additional service Start new EC2 instances when demand increases Stop EC2 instances when demand drops Based on CloudWatch metrics Auto Scaling + Elastic Load Balancer allow for Elastic Scaling 19.10.11 8
The Complete Picture Elastic Load Balancer EC2 EC2 EC2 Auto Scaling EBS EBS EBS 19.10.11 9
AWS: Powerful, but The building blocks for a scalable, global infrastructure are there You need to assemble them You need to deploy applications on the bare (virtual) metal You need to configure it (using CLI tools) Some support available > Amazon Cloud Formation to create templates for Cloud stacks (e.g. Drupal, WordPress, Rails application) > Rightscale has a full business based on it > Automation tools like Chef or Puppet 19.10.11 10
Enter Elastic Beanstalk Elastic Load Balancer Versioned WARs Log Files Web Interface S3 Linux OpenJDK Tomcat Linux OpenJDK Tomcat Linux OpenJDK Tomcat EC2 EC2 EC2 Auto Scaling EBS EBS EBS 19.10.11 11
Elastic Beanstalk Adds > Linux > OpenJDK > Tomcat 6/7 > Easy deployment on the nodes > Versioning for WARs on S3 > Log File storage on S3 and a nice web interface > Deployment > Monitoring > Configuration 19.10.11 12
Basic Elastic Beanstalk Features Application > Versioned WAR file saved in S3 > Environments > Environment Configurations Environment > Installation of a specific version of the WAR file > On AWS infrastructure (Elastic Load Balancer, Auto Scaling, EC2) > Has a specific URL ( http://myapp.elasticbeanstalk.com ) > Can also create your own using Route 53 (Amazon DNS service) Environment Configuration > Set of parameters (e.g. JVM, Tomcat) for an environment Configuration templates > Starting point for custom configurations 19.10.11 13
Sessions in Elastic Beanstalk Data specific to a user can be stored in a HTTP session HTTP session data has to be stored How do you deal with sessions in a cluster? In Memory > Configure Load Balancer with sticky sessions > i.e. requests for the same session always go to the same node > Implemented using Cookies > However: If node fails session data is lost In database > Configure Tomcat to use a JDBC Based Store for session http://tomcat.apache.org/tomcat-7.0-doc/config/manager.html > Use RDS (Relational Database Service) to save the data > New servers will read the session state from RDS 19.10.11 14
Elastic Beanstalk: Advantages Full access and flexibility > ssh on EC2 instances to customize > Create your own AMIs with custom software > Fine tune Tomcat options Built on established AWS services > EC2, EBS, Elastic Load Balancer, Auto Scaling New versions can be installed without downtime Other services can be used > RDS (Relational Database Service) for MySQL and Oracle > can be used for session replication on Tomcat > Your own database / other software on EC2 instances > SimpleDB for a simple yet scalable database > VPC (Virtual Private Cloud) for a secure channel to your data center > Cloudfront as a Content Delivery Network > Direct Connect: Your own direct connection from data center to EC2 19.10.11 15
Elastic Beanstalk: Getting Started Documentation at http://aws.amazon.com/documentation/elasticbeanstalk/ Different ways to use Beanstalk: > AWS toolkit for Eclipse http://aws.amazon.com/eclipse/ > AWS online console at https://console.aws.amazon.com/ > Guided tour to install your first application > Command Line Tool at http://aws.amazon.com/code/aws-elastic-beanstalk > SOAP API http://docs.amazonwebservices.com/elasticbeanstalk/latest/api/ > (Very advanced) 19.10.11 16
Amazon Elastic Beanstalk: Conclusion Combination of existing building block Very flexible Very scalable Can easily be combined with other AWS services No additional charge over AWS services 19.10.11 17