Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
AWS Certified Developer - Associate Guide - Second Edition

You're reading from  AWS Certified Developer - Associate Guide - Second Edition

Product type Book
Published in Jun 2019
Publisher Packt
ISBN-13 9781789617313
Pages 812 pages
Edition 2nd Edition
Languages
Authors (2):
Vipul Tankariya Vipul Tankariya
Profile icon Vipul Tankariya
Bhavin Parmar Bhavin Parmar
Profile icon Bhavin Parmar
View More author details

Table of Contents (30) Chapters

Preface 1. Overview of AWS Certified Developer - Associate Certification 2. Understanding the Fundamentals of Amazon Web Services 3. Identity and Access Management (IAM) 4. Virtual Private Clouds 5. Getting Started with Elastic Compute Cloud (EC2) 6. Handling Application Traffic with ELB 7. Monitoring with CloudWatch 8. Simple Storage Service, Glacier, and CloudFront 9. Other AWS Storage Options 10. AWS Relational Database Service 11. AWS DynamoDB - A NoSQL Database Service 12. Amazon Simple Queue Service (SQS) 13. Simple Notification Service (SNS) 14. AWS Simple Workflow Service (SWF) 15. CloudFormation Overview 16. Understanding Elastic Beanstalk 17. Overview of AWS Lambda 18. Key Management Services 19. Working with AWS Kinesis 20. Working with AWS CodeBuild 21. Getting Started with AWS CodeDeploy 22. Working with AWS CodePipeline 23. CI/CD on AWS 24. Serverless Computing 25. Amazon Route 53 26. ElastiCache Overview 27. Mock Tests 28. Assessments 29. Another Book You May Enjoy

Understanding Elastic Beanstalk

Traditionally, when a web application is deployed on AWS, it may require investing energy in choosing proper AWS services, such as EC2, ELB, and autoscaling. We may need to create and configure an AWS resource from scratch to host a web application. It could be a troublesome undertaking for designers to assemble the framework, arrange the operating system, install the necessary dependencies, and then deploy the web services. AWS Elastic Beanstalk wipes out the need to physically build a framework for the designer and makes it accessible for them to rapidly send and deal with a web application on AWS of any scale.

Developers only need to upload the code. All other aspects, such as capacity provisioning, building, and configuring AWS resources, such as EC2 instances, ELB, autoscaling, and application health monitoring, will be handled by Elastic Beanstalk...

Introduction to Elastic Beanstalk

AWS Elastic Beanstalk is an orchestration service provided by AWS. It can deploy applications that orchestrate a number of AWS services, such as EC2 instances, S3 buckets and objects, CloudWatch, SNS, ELB, and autoscaling. At the time of writing, Elastic Beanstalk supports web applications developed in Java, PHP, .NET, Node.js, Python, Docker, Ruby, and Go. It also supports web servers, such as Apache, NGINX, Passenger, and IIS. An easy way to start working with AWS Elastic Beanstalk is through the AWS web console. AWS also supports CLIs, APIs, and SDKs to work with AWS Elastic Beanstalk. There are no additional charges for using AWS Elastic Beanstalk; charges only apply for using the underlying resources, such as EC2, ELB, and autoscaling.

Most of the deployment and infrastructure tasks, such as uploading a newer version of a web application...

Elastic Beanstalk components

The following lists various Elastic Beanstalk components that work together to make it possible to deploy and manage custom applications easily in the AWS cloud:

  • Application: This is a logical collection of Elastic Beanstalk components, including the environment, versions, and environment configuration. For easy understanding, it can be imagined as a folder.
  • Application version: This refers to a specific source code version for a web application. It points to an Amazon S3 object containing deployment code, such as a Java .war file. The application version is part of an application. Each application can have multiple versions. Generally, applications run with the latest code version. At times, multiple versions of an application may run simultaneously for catering to users in a different location or for testing purposes.
  • Environment: There are two...

Elastic Beanstalk environment tiers

In this section, let's understand some of the architectural concepts of Elastic Beanstalk. As you understood from the core concepts, an environment is an essential component used to deploy a web application. Creating a new environment requires selecting the appropriate environment tier, platform, and environment type. Broadly speaking, environment tiers are divided into two environments:

  • The web server environment: This tier hosts a web application and handles HTTP(S) requests.
  • The worker environment: This tier hosts a web application and handles long-running or scheduled background processing tasks.

A detailed description of these environment tiers will be given in the following subsections.

The web server environment tier

...

Elastic Beanstalk-supported platforms

The platform supported by Elastic Beanstalk defines the instance software configuration. Platforms are broadly divided into two categories:

  • Preconfigured platforms: These are also called Elastic Beanstalk-supported platforms. These platforms are available in multiple configurations of various programming languages, Docker containers, and/or web containers. Based on the selected platform, Elastic Beanstalk will install the specific stack of software on one or more Amazon EC2 instances. At present, all Linux platforms are running on Amazon Linux 2017.03 (64-bit). At a very high level, preconfigured supported platforms include the following:
    • Packer builder
    • Single container Docker
    • Multicontainer Docker
    • Preconfigured Docker Go
    • Java SE
    • Java with Tomcat
    • .NET on Windows Server with IIS Node.js
    • PHP
    • Python
    • Ruby (Passenger Standalone)
    • Ruby (Puma)
    • Node...

Creating a web application source bundle

Whether deploying a new web application or updating a version for an existing web application in Elastic Beanstalk, it is essential to prepare a source bundle of source code. In general, the characteristics of source bundles for any programming language are as follows:

  • It should be a single ZIP or WAR file.
  • If there are multiple WAR files, it can be packed in a single ZIP file.
  • The overall file size should not exceed 512 MB.
  • It can have subdirectories but not parent directories.
To deploy a worker application in a worker tier, the application source bundle must also include the cron.yaml file.

A detailed understanding of preparing a source bundle can be obtained by visiting https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/applications-sourcebundle.html.

Getting started using Elastic Beanstalk

With the help of the following steps, an easy Elastic Beanstalk web application can be created, viewed, deployed, updated, and terminated.

Step 1 – signing in to the AWS account

You will need to understand the following guidelines to complete step 1 and sign in to the AWS account:

  1. Sign in to the AWS account with the IAM user having sufficient privileges to work with AWS Elastic Beanstalk. In addition to the privileges to manipulate resources in Elastic Beanstalk, the IAM user also requires privileges to create, modify, and delete underlying resources in various AWS services, such as EC2, ELB, S3, and autoscaling. The requirements for such AWS service privileges vary from application...

The version life cycle

Elastic Beanstalk creates a newer application version upon uploading a newer source code bundle. Creating a newer version and not deleting the old unwanted application version leads to hitting the application version limit. As a result, it does not allow us to create any newer web application versions.

The default Elastic Beanstalk limits are as follows:

Resource Default limit
Applications 75
Application versions 1,000
Environments 200

With the help of the application version life cycle policy for an application, hitting an application version limit can be avoided. Consequently, it will manage the number of available application versions at any given time. Once the life cycle policy is enabled, it will keep either the total count of recent versions (that is, the last 200 versions of the application) or the versions that are not older than the...

Deploying web applications to Elastic Beanstalk environments

Elastic Beanstalk allows you to create a new web application, update an environment with a newer web application version, or redeploy an earlier version of the application. Deploying a new web application is very quick. It creates an underlying required AWS resource and deploys a web application. It is important to understand the following points while deploying an application to Elastic Beanstalk:

  • While updating a newer version of a web application, you can perform in-place updates. This means that the already deployed web application will be updated with a newer source bundle.
  • Redeploying the application may result in restarting the web container or the web application server. As a result, the web application may be unavailable for a while during the deployment process.
  • When an environment has more than one EC2 instances...

Monitoring the web application environment

Once a web application is successfully deployed, it is very important to monitor its performance. Monitoring helps to find out whether there is any infrastructure bottleneck, performance issue, or underutilization of resources. The Elastic Beanstalk web console gives a high-level overview in terms of monitoring figures and graphs, as shown in the following screenshot:

Figure 16.19: The Monitoring dashboard

Elastic Beanstalk also offers various other methods to monitor a deployed web application, such as basic health reporting, enhanced health reporting and monitoring, managing alarms, the Elastic Beanstalk environment's event stream, listing and connecting to server instances, and viewing logs from the Elastic Beanstalk environment's EC2 instances.

A detailed understanding of the various monitoring methods can be obtained from...

Elastic Beanstalk best practices

Web application deployment on Elastic Beanstalk ultimately uses AWS services, such as EC2, ELB, ASG, SQS, S3, and many others. Points such as scalability, security, persistent storage, fault tolerance, content delivery, software updates, patching, and connectivity should be kept in mind when designing applications to deploy on AWS Elastic Beanstalk. The following list describes some of the best practices that you should follow while working with Elastic Beanstalk:

  • Web applications should be as stateless as possible, fault tolerant, and loosely coupled to efficiently scale out and scale in as the end user's request increases and decreases, respectively.
  • On AWS, security is a shared responsibility. AWS is responsible for providing the necessary physical resources (as and when) to make the cloud a safe place to deploy our applications, and we...

Summary

  • AWS Elastic Beanstalk is an orchestration service provided by AWS. It can deploy applications that orchestrate a number of AWS services, such as EC2 instances, S3 buckets and objects, CloudWatch, SNS, ELB, and autoscaling.
  • Most of the deployment and infrastructure tasks, such as uploading a newer version of a web application and changing the size of the Amazon EC2 instances, can be done directly from the Elastic Beanstalk web console.
  • The web server environment and the worker environment are the two environment tiers supported by Elastic Beanstalk.
  • Every Elastic Beanstalk environment carries a CNAME and an alias in Amazon Route 53 pointing to the ELB.
  • The Elastic Beanstalk source bundle should be a single ZIP or WAR file.
  • To deploy a worker application in a worker tier, the application source bundle must also include the cron.yaml file.
  • Creating a web application and...
lock icon The rest of the chapter is locked
You have been reading a chapter from
AWS Certified Developer - Associate Guide - Second Edition
Published in: Jun 2019 Publisher: Packt ISBN-13: 9781789617313
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime}