AWS Elastic Beanstalk Developer Guide

User Manual:

Open the PDF directly: View PDF PDF.
Page Count: 1150 [warning: Documents this large are best viewed by clicking the View PDF Link!]

AWS Elastic Beanstalk
Developer Guide
API Version 2010-12-01
AWS Elastic Beanstalk Developer Guide
AWS Elastic Beanstalk: Developer Guide
Copyright © 2018 Amazon Web Services, Inc. and/or its affiliates. All rights reserved.
Amazon's trademarks and trade dress may not be used in connection with any product or service that is not Amazon's, in any manner
that is likely to cause confusion among customers, or in any manner that disparages or discredits Amazon. All other trademarks not
owned by Amazon are the property of their respective owners, who may or may not be affiliated with, connected to, or sponsored by
Amazon.
AWS Elastic Beanstalk Developer Guide
Table of Contents
What Is AWS Elastic Beanstalk? ............................................................................................................ 1
Storage ..................................................................................................................................... 2
Pricing ...................................................................................................................................... 2
Community ............................................................................................................................... 2
Where to Go Next ...................................................................................................................... 2
Getting Started .................................................................................................................................. 3
Step 1: Sign up for the Service .................................................................................................... 3
Step 2: Create an Application ...................................................................................................... 3
Step 3: View Information About Your Environment ......................................................................... 6
Step 4: Deploy a New Application Version ..................................................................................... 7
Step 5: Change Conguration ...................................................................................................... 9
Step 6: Clean Up ...................................................................................................................... 10
Where to Go Next .................................................................................................................... 11
The EB CLI ...................................................................................................................... 11
AWS SDK for Java ............................................................................................................ 11
AWS Toolkit for Eclipse ..................................................................................................... 12
AWS SDK for .NET ............................................................................................................ 12
AWS Toolkit for Visual Studio ............................................................................................ 12
AWS SDK for Node.js ........................................................................................................ 12
AWS SDK for PHP ............................................................................................................ 12
Boto (AWS SDK for Python) ............................................................................................... 13
AWS SDK for Ruby ........................................................................................................... 13
Concepts ......................................................................................................................................... 14
Application .............................................................................................................................. 14
Application Version ................................................................................................................... 14
Environment ............................................................................................................................ 14
Environment Tier ...................................................................................................................... 14
Environment Conguration ........................................................................................................ 14
Conguration Template ............................................................................................................. 15
Web Server Environments ......................................................................................................... 15
Worker Environments ................................................................................................................ 16
Design Considerations ............................................................................................................... 17
Scalability ........................................................................................................................ 17
Security ........................................................................................................................... 18
Persistent Storage ............................................................................................................ 18
Fault Tolerance ................................................................................................................ 19
Content Delivery .............................................................................................................. 19
Software Updates and Patching ......................................................................................... 19
Connectivity ..................................................................................................................... 19
Permissions ..................................................................................................................................... 21
Service Role ............................................................................................................................. 21
Instance Prole ........................................................................................................................ 22
User Policy .............................................................................................................................. 24
Elastic Beanstalk Platforms ................................................................................................................ 26
Supported Platforms ................................................................................................................ 26
Packer Builder .................................................................................................................. 27
Single Container Docker .................................................................................................... 27
Multicontainer Docker ....................................................................................................... 27
Precongured Docker ........................................................................................................ 28
Go .................................................................................................................................. 29
Java SE ........................................................................................................................... 29
Java with Tomcat ............................................................................................................. 30
.NET on Windows Server with IIS ....................................................................................... 30
Node.js ............................................................................................................................ 32
API Version 2010-12-01
iii
AWS Elastic Beanstalk Developer Guide
PHP ................................................................................................................................ 33
Python ............................................................................................................................ 34
Ruby ............................................................................................................................... 34
Custom Platforms .................................................................................................................... 36
Creating a Custom Platform .............................................................................................. 37
Using a Sample Custom Platform ....................................................................................... 38
Platform Denition Archive Contents .................................................................................. 41
Platform Hooks ................................................................................................................ 42
Platform Scripts ............................................................................................................... 42
Packer Instance Cleanup .................................................................................................... 43
Platform.yaml Format ....................................................................................................... 43
Tutorials and Samples ....................................................................................................................... 47
Managing Applications ...................................................................................................................... 49
Application Management Console ............................................................................................... 49
Managing Application Versions ................................................................................................... 53
Version Lifecycle ...................................................................................................................... 56
Setting the Application Lifecycle Settings in the Console ....................................................... 57
Create a Source Bundle ............................................................................................................. 58
Creating a Source Bundle from the Command Line ............................................................... 58
Creating a Source Bundle with Git ...................................................................................... 59
Zipping Files in Mac OS X Finder or Windows Explorer .......................................................... 59
Creating a Source Bundle for a .NET Application ................................................................... 63
Testing Your Source Bundle ............................................................................................... 64
Managing Environments .................................................................................................................... 65
The Environment Management Console ...................................................................................... 65
Environment Dashboard .................................................................................................... 67
Environment Management Actions ..................................................................................... 68
Conguration ................................................................................................................... 70
Logs ............................................................................................................................... 71
Health ............................................................................................................................. 71
Monitoring ....................................................................................................................... 72
Alarms ............................................................................................................................ 73
Managed Updates ............................................................................................................ 74
Events ............................................................................................................................. 74
Tags ................................................................................................................................ 75
Creating Environments .............................................................................................................. 76
The Create New Environment Wizard .................................................................................. 78
Clone an Environment ..................................................................................................... 110
Terminate an Environment ............................................................................................... 114
With the AWS CLI ........................................................................................................... 116
With the API .................................................................................................................. 117
Launch Now URL ............................................................................................................ 119
Compose Environments ................................................................................................... 122
Deployments .......................................................................................................................... 124
Deployment Options ....................................................................................................... 125
Blue/Green Deployments ................................................................................................. 129
Deploying a New Application Version ................................................................................ 132
Redeploying a Previous Version ........................................................................................ 133
Conguration Changes ............................................................................................................ 133
Rolling Updates .............................................................................................................. 134
Immutable Updates ........................................................................................................ 138
Tag an Environment ........................................................................................................ 140
Platform Updates ................................................................................................................... 143
Managed Updates ........................................................................................................... 145
Upgrade a Legacy Environment ........................................................................................ 149
Cancel an Update ................................................................................................................... 151
Rebuild an Environment .......................................................................................................... 152
API Version 2010-12-01
iv
AWS Elastic Beanstalk Developer Guide
Rebuilding a Running Environment ................................................................................... 152
Rebuilding a Terminated Environment ............................................................................... 153
Environment Types ................................................................................................................. 154
Load-balancing, Autoscaling Environment .......................................................................... 154
Single-instance Environment ............................................................................................ 155
Changing Environment Type ............................................................................................ 155
Worker Environments .............................................................................................................. 156
The Worker Environment SQS Daemon ............................................................................. 158
Dead Letter Queues ........................................................................................................ 159
Periodic Tasks ................................................................................................................ 159
Use Amazon CloudWatch for Auto Scaling in Worker Environment Tiers ................................. 160
Conguring Worker Environments .................................................................................... 160
Environment Links .................................................................................................................. 162
Environment Conguration .............................................................................................................. 164
Auto Scaling Group ................................................................................................................. 165
Conguring Your Environment's Auto Scaling Group ........................................................... 165
The aws:autoscaling:asg Namespace ................................................................................. 167
EC2 Instances ................................................................................................................. 167
Triggers ......................................................................................................................... 170
Scheduled Actions .......................................................................................................... 172
Health Check Setting ...................................................................................................... 175
Load Balancer ........................................................................................................................ 176
Conguring a Classic Load Balancer .................................................................................. 176
Load Balancer Conguration Namespaces .......................................................................... 180
Application Load Balancer ............................................................................................... 181
Network Load Balancer ................................................................................................... 184
Conguring Access Logs .................................................................................................. 186
Database ............................................................................................................................... 186
Adding an Amazon RDS DB Instance to Your Environment ................................................... 187
Connecting to the database ............................................................................................. 188
Conguring an Integrated RDS DB Instance ....................................................................... 188
Software Settings ................................................................................................................... 189
Conguring Environment Properties ................................................................................. 190
Software Setting Namespaces .......................................................................................... 191
Accessing Environment Properties ..................................................................................... 192
Debugging ............................................................................................................................. 192
Conguring Debugging ................................................................................................... 194
The aws:elasticbeanstalk:xray Namespace .......................................................................... 194
Notications .......................................................................................................................... 195
Conguring Notications ................................................................................................. 195
The aws:elasticbeanstalk:sns:topics Namespace .................................................................. 196
Log Streaming ....................................................................................................................... 197
Conguring Log Streaming .............................................................................................. 197
The aws:elasticbeanstalk:cloudwatch:logs Namespace ......................................................... 198
VPC ...................................................................................................................................... 198
Domain Name ........................................................................................................................ 199
Updating tags ........................................................................................................................ 201
Advanced Conguration .................................................................................................................. 202
Conguration Options ............................................................................................................. 202
Precedence .................................................................................................................... 203
Recommended Values ..................................................................................................... 203
Before Environment Creation ........................................................................................... 205
During Creation .............................................................................................................. 209
After Creation ................................................................................................................ 213
General Options ............................................................................................................. 220
Platform Specic Options ................................................................................................ 248
Custom Options ............................................................................................................. 255
API Version 2010-12-01
v
AWS Elastic Beanstalk Developer Guide
.ebextensions ......................................................................................................................... 256
Option Settings .............................................................................................................. 257
Linux Server ................................................................................................................... 258
Windows Server ............................................................................................................. 269
Custom Resources ........................................................................................................... 275
Saved Congurations .............................................................................................................. 293
env.yaml ............................................................................................................................. 296
Custom Image ........................................................................................................................ 297
HTTPS ................................................................................................................................... 299
Create a Certicate ......................................................................................................... 300
Upload a Certicate ........................................................................................................ 302
Terminate at the Load Balancer ........................................................................................ 302
Terminate at the Instance ................................................................................................ 304
End-to-End Encryption .................................................................................................... 324
TCP Passthrough ............................................................................................................ 326
Store Keys Securely ........................................................................................................ 327
Monitoring an Environment ............................................................................................................. 329
Monitoring Console ................................................................................................................. 329
Overview ....................................................................................................................... 329
Monitoring Graphs .......................................................................................................... 330
Customizing the Monitoring Console ................................................................................. 331
Basic Health Reporting ............................................................................................................ 333
Health Colors ................................................................................................................. 333
Elastic Load Balancing Health Check ................................................................................. 334
Single Instance Environment Health Check ........................................................................ 334
Additional Checks ........................................................................................................... 334
Amazon CloudWatch Metrics ............................................................................................ 335
Enhanced Health Reporting and Monitoring ............................................................................... 336
The Elastic Beanstalk Health Agent ................................................................................... 337
Factors in Determining Instance and Environment Health .................................................... 338
Enhanced Health Roles .................................................................................................... 340
Enhanced Health Events .................................................................................................. 340
Enhanced Health Reporting Behavior During Updates, Deployments, and Scaling .................... 341
Enable Enhanced Health .................................................................................................. 341
Health Console ............................................................................................................... 344
Health Colors and Statuses .............................................................................................. 349
Instance Metrics ............................................................................................................. 351
CloudWatch ................................................................................................................... 352
API Users ....................................................................................................................... 357
Enhanced Health Log Format ........................................................................................... 359
Notications and Troubleshooting .................................................................................... 361
Manage Alarms ...................................................................................................................... 362
View Events ........................................................................................................................... 365
Monitor Instances ................................................................................................................... 367
View Instance Logs ................................................................................................................. 369
Log Location on-Instance ................................................................................................ 371
Log Location in S3 ......................................................................................................... 371
Log Rotation Settings on Linux ........................................................................................ 372
Extending the Default Log Task Conguration .................................................................... 372
Amazon CloudWatch Logs ............................................................................................... 374
Integrating AWS Services ................................................................................................................. 376
Architectural Overview ............................................................................................................ 376
CloudFront ............................................................................................................................. 377
CloudTrail .............................................................................................................................. 377
Elastic Beanstalk Information in CloudTrail History ............................................................. 377
Elastic Beanstalk Information in CloudTrail Logging ............................................................ 377
Understanding Elastic Beanstalk Log File Entries ................................................................ 378
API Version 2010-12-01
vi
AWS Elastic Beanstalk Developer Guide
CloudWatch ........................................................................................................................... 379
CloudWatch Logs .................................................................................................................... 379
Streaming CloudWatch Logs ............................................................................................ 381
Setting Up CloudWatch Logs Integration with Configuration Files ......................................... 384
Troubleshooting CloudWatch Logs Integration ................................................................... 385
DynamoDB ............................................................................................................................. 386
ElastiCache ............................................................................................................................ 386
Amazon EFS ........................................................................................................................... 387
Conguration Files .......................................................................................................... 387
Encrypted File Systems ................................................................................................... 388
Sample Applications ....................................................................................................... 388
IAM ....................................................................................................................................... 388
Instance Proles ............................................................................................................. 388
Service Roles .................................................................................................................. 393
User Policies .................................................................................................................. 403
ARN Format ................................................................................................................... 407
Resources and Conditions ................................................................................................ 408
Example Policies ............................................................................................................. 430
Example Policies Based on Resource Permissions ................................................................ 432
Amazon RDS .......................................................................................................................... 439
Launching and Connecting to an External RDS Instance in a Default VPC ................................ 440
Launching and Connecting to an External RDS Instance in EC2 Classic ................................... 444
Storing the Connection String in Amazon S3 ..................................................................... 449
Amazon S3 ............................................................................................................................ 451
Amazon VPC .......................................................................................................................... 451
What VPC Congurations Do I Need? ................................................................................ 452
Single-Instance Environment in a VPC ............................................................................... 453
Load-Balancing Environment with Private Instances ............................................................ 458
Bastion Hosts ................................................................................................................. 462
Amazon RDS .................................................................................................................. 466
Load-Balancing Environment with Public Instances ............................................................. 472
Your Local Development Environment ............................................................................................... 477
Creating a Project Folder ......................................................................................................... 477
Setting Up Source Control ....................................................................................................... 477
Conguring a Remote Repository ............................................................................................. 478
Installing the EB CLI ............................................................................................................... 478
Installing the AWS CLI ............................................................................................................. 478
The EB CLI ..................................................................................................................................... 480
Install the EB CLI .................................................................................................................... 481
Linux ............................................................................................................................. 482
Windows ....................................................................................................................... 485
macOS .......................................................................................................................... 486
Virtualenv ...................................................................................................................... 488
Congure the EB CLI ............................................................................................................... 489
Ignoringles with .ebignore ............................................................................................ 491
Using Named Proles ...................................................................................................... 491
Deploying an Artifact Instead of the Project Folder ............................................................. 491
Conguration Settings and Precedence ............................................................................. 492
Instance Metadata .......................................................................................................... 492
EB CLI Basics .......................................................................................................................... 492
eb create ....................................................................................................................... 493
eb status ....................................................................................................................... 493
eb health ....................................................................................................................... 494
eb events ...................................................................................................................... 494
eb logs .......................................................................................................................... 495
eb open ........................................................................................................................ 495
eb deploy ...................................................................................................................... 495
API Version 2010-12-01
vii
AWS Elastic Beanstalk Developer Guide
eb cong ....................................................................................................................... 496
eb terminate .................................................................................................................. 496
AWS CodeBuild ...................................................................................................................... 497
Creating an Application ................................................................................................... 497
Using the EB CLI with Git ........................................................................................................ 497
Associating Elastic Beanstalk environments with Git branches .............................................. 497
Deploying changes .......................................................................................................... 498
Using Git submodules ..................................................................................................... 498
Assigning Git tags to your application version .................................................................... 499
AWS CodeCommit .................................................................................................................. 499
Prerequisites .................................................................................................................. 499
Creating an AWS CodeCommit Repository with the EB CLI ................................................... 500
Deploying from Your AWS CodeCommit Repository ............................................................ 500
Conguring Additional Branches and Environments ............................................................ 501
Using an Existing AWS CodeCommit Repository ................................................................. 502
Monitoring Health .................................................................................................................. 503
Reading the Output ........................................................................................................ 505
Interactive Health View ................................................................................................... 506
Interactive Health View Options ....................................................................................... 507
Composing Environments ........................................................................................................ 508
Troubleshooting ..................................................................................................................... 509
Troubleshooting deployments .......................................................................................... 509
EB CLI Commands .................................................................................................................. 511
eb abort ..................................................................................................................... 512
eb appversion ........................................................................................................... 513
eb clone ..................................................................................................................... 515
eb codesource ........................................................................................................... 517
eb config ................................................................................................................... 518
eb console ................................................................................................................. 520
eb create ................................................................................................................... 521
eb deploy ................................................................................................................... 527
eb events ................................................................................................................... 529
eb health ................................................................................................................... 530
eb init ...................................................................................................................... 532
eb labs ...................................................................................................................... 534
eb list ...................................................................................................................... 535
eb local ..................................................................................................................... 536
eb logs ...................................................................................................................... 538
eb open ...................................................................................................................... 539
eb platform ............................................................................................................... 540
eb printenv ............................................................................................................... 546
eb restore ................................................................................................................. 547
eb scale ..................................................................................................................... 548
eb setenv ................................................................................................................... 548
eb ssh ........................................................................................................................ 549
eb status ................................................................................................................... 551
eb swap ...................................................................................................................... 552
eb tags ...................................................................................................................... 553
eb terminate ............................................................................................................. 555
eb upgrade ................................................................................................................. 556
eb use ........................................................................................................................ 557
Common Options ........................................................................................................... 558
EB CLI 2.6 (Deprecated) ........................................................................................................... 558
Dierences from Version 3 of EB CLI ................................................................................. 559
Migrating to EB CLI 3 and AWS CodeCommit ..................................................................... 559
Getting Started with Eb .................................................................................................. 560
Deploying a Branch to an Environment ............................................................................. 565
API Version 2010-12-01
viii
AWS Elastic Beanstalk Developer Guide
Eb Common Options ....................................................................................................... 567
EB CLI 2 Commands ....................................................................................................... 567
EB API CLI (deprecated) ........................................................................................................... 585
Converting Elastic Beanstalk API CLI Scripts ....................................................................... 585
Getting Set Up ............................................................................................................... 587
Common Options ........................................................................................................... 589
Operations ..................................................................................................................... 590
Working with Docker ...................................................................................................................... 632
Docker Platform Congurations ............................................................................................... 632
Single Container Docker .................................................................................................. 632
Multicontainer Docker ..................................................................................................... 632
Precongured Docker Containers ...................................................................................... 633
Single Container Docker .......................................................................................................... 633
Sample PHP Application .................................................................................................. 634
Sample Python Application .............................................................................................. 634
Sample Dockerfile Application .......................................................................................... 634
Single Container Docker Conguration .............................................................................. 634
Multicontainer Docker ............................................................................................................. 638
Multicontainer Docker Platform ........................................................................................ 639
Dockerrun.aws.json File ................................................................................................... 639
Docker Images ............................................................................................................... 640
Container Instance Role ................................................................................................... 640
Amazon ECS Resources Created by Elastic Beanstalk ........................................................... 641
Using Multiple Elastic Load Balancing Listeners .................................................................. 641
Failed Container Deployments .......................................................................................... 642
Multicontainer Docker Conguration ................................................................................. 642
Tutorial - Multicontainer Docker ....................................................................................... 646
Precongured Containers ......................................................................................................... 652
Getting Started with Preconfigured Docker Containers ........................................................ 652
Example: Customize and Configure Preconfigured Docker Platforms ...................................... 654
Environment Conguration ...................................................................................................... 655
Docker Images ............................................................................................................... 656
Conguring Additional Storage Volumes ........................................................................... 658
Reclaiming Docker Storage Space ..................................................................................... 659
Running Containers Locally ...................................................................................................... 659
Prerequisites for Running Docker Applications Locally ......................................................... 659
Preparing a Docker Application for Use with the EB CLI ....................................................... 660
Running a Docker Application Locally ................................................................................ 660
Cleaning Up After Running a Docker Application Locally ...................................................... 662
Working with Go ............................................................................................................................ 664
The Go Platform .................................................................................................................... 664
Conguring Your Go Environment .................................................................................... 665
The aws:elasticbeanstalk:container:golang:staticfiles Namespace ........................................... 665
Procle .......................................................................................................................... 666
Buildle ......................................................................................................................... 667
Proxy Conguration ........................................................................................................ 667
The Docker-based Go Platform ................................................................................................ 668
Set Up Your Local Development Environment .................................................................... 668
Develop and Test Locally Using Docker ............................................................................. 668
Deploy to Elastic Beanstalk .............................................................................................. 669
Working with Java .......................................................................................................................... 671
Getting Started ...................................................................................................................... 671
Launching an Environment with a Sample Java Application .................................................. 672
Next Steps ..................................................................................................................... 676
Development Environment ...................................................................................................... 676
Installing the Java Development Kit .................................................................................. 677
Installing a Web Container ............................................................................................... 677
API Version 2010-12-01
ix
AWS Elastic Beanstalk Developer Guide
Downloading Libraries ..................................................................................................... 677
Installing the AWS SDK for Java ....................................................................................... 677
Installing an IDE or Text Editor ......................................................................................... 677
Installing the AWS Toolkit for Eclipse ................................................................................ 678
The Tomcat Platform .............................................................................................................. 678
Conguring Your Tomcat Environment .............................................................................. 678
Tomcat Conguration Namespaces ................................................................................... 680
Bundling WAR Files ......................................................................................................... 681
Structuring your Project Folder ........................................................................................ 681
Proxy Conguration ........................................................................................................ 684
The Java SE Platform .............................................................................................................. 686
Conguring Your Java SE Environment .............................................................................. 687
The aws:elasticbeanstalk:container:java:staticfiles Namespace ............................................... 687
Procle .......................................................................................................................... 688
Buildle ......................................................................................................................... 689
Proxy Conguration ........................................................................................................ 689
Adding a Database ................................................................................................................. 690
Downloading the JDBC Driver .......................................................................................... 691
Connecting to a Database (Java SE Platforms) .................................................................... 692
Connecting to a Database (Tomcat Platforms) .................................................................... 692
Troubleshooting Database Connections ............................................................................. 694
Eclipse Toolkit ........................................................................................................................ 696
Importing Existing Environments into Eclipse ..................................................................... 696
Managing Environments .................................................................................................. 696
Managing Multiple AWS Accounts ..................................................................................... 706
Viewing Events ............................................................................................................... 707
Listing and Connecting to Server Instances ........................................................................ 708
Terminating an Environment ............................................................................................ 709
Resources .............................................................................................................................. 709
Working with .NET .......................................................................................................................... 710
Getting Started ...................................................................................................................... 710
Launching an Environment with a Sample .NET Application .................................................. 711
Next Steps ..................................................................................................................... 713
Development Environment ...................................................................................................... 713
Installing an IDE ............................................................................................................. 713
Installing the AWS Toolkit for Visual Studio ....................................................................... 713
The .NET Platform .................................................................................................................. 713
Configuring your .NET Environment in the AWS Management Console ................................... 714
The aws:elasticbeanstalk:container:dotnet:apppool Namespace ............................................. 715
Migrating to v1 Elastic Beanstalk Windows Server Platforms ................................................ 715
Deployment Manifest ...................................................................................................... 716
Tutorial - ASP.NET MVC5 ......................................................................................................... 720
Create the Environment .................................................................................................. 720
Publish Your Application to Elastic Beanstalk ..................................................................... 726
Clean Up Your AWS Resources ......................................................................................... 733
Tutorial - .NET Core ................................................................................................................ 734
Prerequisites .................................................................................................................. 734
Generate a .NET Core Project ........................................................................................... 735
Launch an Elastic Beanstalk Environment .......................................................................... 736
Update the Source Code .................................................................................................. 736
Deploy Your Application .................................................................................................. 739
Clean Up ....................................................................................................................... 741
Next Steps ..................................................................................................................... 741
Adding a Database ................................................................................................................. 742
Adding a DB Instance to Your Environment ........................................................................ 742
Downloading a Driver ..................................................................................................... 743
Connecting to a Database ............................................................................................... 743
API Version 2010-12-01
x
AWS Elastic Beanstalk Developer Guide
The AWS Toolkit for Visual Studio ............................................................................................ 744
Test Locally .................................................................................................................... 745
Create an Elastic Beanstalk Environment ........................................................................... 745
Terminating an Environment ............................................................................................ 754
Deploy .......................................................................................................................... 754
Managing Environments .................................................................................................. 757
Managing Accounts ......................................................................................................... 766
Debug ........................................................................................................................... 767
Monitor ......................................................................................................................... 768
Deployment Tool ............................................................................................................ 769
Resources .............................................................................................................................. 770
Working with Node.js ...................................................................................................................... 772
Getting Started ...................................................................................................................... 772
Launching an Environment with a Sample Node.js Application .............................................. 772
Next Steps ..................................................................................................................... 775
Development Environment ...................................................................................................... 775
Installing Node.js ............................................................................................................ 775
Installing npm ................................................................................................................ 775
Installing the AWS SDK for Node.js ................................................................................... 776
Installing Express ............................................................................................................ 776
Installing Geddy ............................................................................................................. 776
The Node.js Platform .............................................................................................................. 777
Conguring Your Node.js Environment .............................................................................. 778
Node.js Conguration Namespaces ................................................................................... 779
Installing Packages with a Package.json File ....................................................................... 779
Locking Dependencies with npm shrinkwrap ...................................................................... 780
Conguring the Proxy Server ........................................................................................... 780
Tutorial - Express .................................................................................................................... 782
Prerequisites .................................................................................................................. 782
Install Express and Generate a Project ............................................................................... 782
Create an Elastic Beanstalk Environment ........................................................................... 783
Update the Application ................................................................................................... 784
Clean Up ....................................................................................................................... 786
Tutorial - Node.js w/ DynamoDB .............................................................................................. 786
Prerequisites .................................................................................................................. 787
Launch an Elastic Beanstalk Environment .......................................................................... 787
Add Permissions to Your Environment's Instances ............................................................... 788
Deploy the Sample Application ........................................................................................ 789
Create a DynamoDB Table ............................................................................................... 791
Update the Application's Conguration Files ...................................................................... 791
Congure Your Environment for High Availability ............................................................... 794
Clean Up ....................................................................................................................... 794
Next Steps ..................................................................................................................... 795
Tutorial - Geddy with Clustering ............................................................................................... 795
Step 1: Set Up Your Git Repository ................................................................................... 795
Step 2: Set Up Your Geddy Development Environment ........................................................ 795
Step 3: Congure Elastic Beanstalk ................................................................................... 796
Step 5: View the Application ............................................................................................ 798
Step 6: Update the Application ........................................................................................ 798
Step 7: Clean Up ............................................................................................................ 805
Adding a Database ................................................................................................................. 805
Adding a DB Instance to Your Environment ........................................................................ 805
Downloading a Driver ..................................................................................................... 806
Connecting to a Database ............................................................................................... 807
Resources .............................................................................................................................. 807
Working with PHP .......................................................................................................................... 808
The PHP Platform .................................................................................................................. 808
API Version 2010-12-01
xi
AWS Elastic Beanstalk Developer Guide
Conguring your PHP Environment ................................................................................... 809
The aws:elasticbeanstalk:container:php:phpini Namespace ................................................... 810
Composer File ................................................................................................................ 810
Update Composer ........................................................................................................... 811
Extending php.ini ........................................................................................................... 811
Tutorial - Laravel 5.2 .............................................................................................................. 811
Prerequisites .................................................................................................................. 812
Install Composer ............................................................................................................ 812
Install Laravel and Generate a Website .............................................................................. 813
Create an Elastic Beanstalk Environment and Deploy Your Application ................................... 813
Add a Database to Your Environment ................................................................................ 815
Clean Up ....................................................................................................................... 817
Next Steps ..................................................................................................................... 818
Tutorial - CakePHP 3.2 ............................................................................................................ 818
Prerequisites .................................................................................................................. 819
Install Composer ............................................................................................................ 819
Install CakePHP and Generate a Website ........................................................................... 820
Create an Elastic Beanstalk Environment and Deploy Your Application ................................... 820
Add a Database to Your Environment ................................................................................ 823
Clean Up ....................................................................................................................... 824
Next Steps ..................................................................................................................... 825
Tutorial - Symfony2 ................................................................................................................ 825
Set Up Your Symfony2 Development Environment .............................................................. 826
Congure Elastic Beanstalk .............................................................................................. 827
View the Application ....................................................................................................... 828
Update the Application ................................................................................................... 829
Clean Up ....................................................................................................................... 829
Tutorial - HA Production ......................................................................................................... 829
Prerequisites .................................................................................................................. 830
Launch a DB Instance in Amazon RDS ............................................................................... 830
Launch an Elastic Beanstalk Environment .......................................................................... 832
Configure Security Groups, Environment Properties, and Scaling ........................................... 833
Deploy the Sample Application ........................................................................................ 834
Clean Up ....................................................................................................................... 836
Next Steps ..................................................................................................................... 837
Tutorial - HA WordPress .......................................................................................................... 837
Launch a DB Instance in Amazon RDS ............................................................................... 838
Download WordPress ...................................................................................................... 840
Launch an Elastic Beanstalk Environment .......................................................................... 841
Configure Security Groups and Environment Properties ....................................................... 842
Install WordPress ............................................................................................................ 843
Updating keys and salts .................................................................................................. 843
Update the Environment ................................................................................................. 844
Congure Autoscaling ..................................................................................................... 845
Review .......................................................................................................................... 845
Clean Up ....................................................................................................................... 846
Next Steps ..................................................................................................................... 846
Tutorial - HA Drupal ............................................................................................................... 847
Launch a DB Instance in Amazon RDS ............................................................................... 847
Download Drupal ............................................................................................................ 850
Launch an Elastic Beanstalk Environment .......................................................................... 851
Configure Security Groups and Environment Properties ....................................................... 851
Install Drupal ................................................................................................................. 853
Update the Environment ................................................................................................. 854
Congure Autoscaling ..................................................................................................... 854
Review .......................................................................................................................... 855
Clean Up ....................................................................................................................... 855
API Version 2010-12-01
xii
AWS Elastic Beanstalk Developer Guide
Next Steps ..................................................................................................................... 856
Adding a Database ................................................................................................................. 856
Adding a DB Instance to Your Environment ........................................................................ 857
Downloading a Driver ..................................................................................................... 858
Connecting to a Database with a PDO or MySQLi ............................................................... 858
Resources .............................................................................................................................. 859
Working with Python ...................................................................................................................... 860
Development Environment ...................................................................................................... 860
Common Prerequisites .................................................................................................... 860
Setting up a virtual Python environment ........................................................................... 861
Conguring a Python project for Elastic Beanstalk .............................................................. 861
The Python Platform .............................................................................................................. 862
Conguring Your Python Environment .............................................................................. 862
Python Conguration Namespaces .................................................................................... 863
Requirements File ........................................................................................................... 864
Tutorial - Flask 0.10 ................................................................................................................ 865
Prerequisites .................................................................................................................. 865
Set Up a Python Virtual Environment with Flask ................................................................. 865
Create a Flask Application ............................................................................................... 866
Configure Your Flask Application for Elastic Beanstalk ......................................................... 868
Deploy Your Site With the EB CLI ..................................................................................... 868
Clean Up and Next Steps ................................................................................................. 870
Tutorial - Django 1.9 ............................................................................................................... 870
Prerequisites .................................................................................................................. 871
Set Up a Python Virtual Environment with Django .............................................................. 871
Create a Django Project ................................................................................................... 872
Configure Your Django Application for Elastic Beanstalk ...................................................... 874
Deploy Your Site With the EB CLI ..................................................................................... 875
Updating Your Application ............................................................................................... 877
Clean Up and Next Steps ................................................................................................. 880
Adding a Database ................................................................................................................. 881
Adding a DB Instance to Your Environment ........................................................................ 881
Downloading a Driver ..................................................................................................... 882
Connecting to a Database ............................................................................................... 883
Tools and Resources ................................................................................................................ 883
Working with Ruby ......................................................................................................................... 884
The Ruby Platform ................................................................................................................. 884
Conguring Your Ruby Environment ................................................................................. 885
Ruby Conguration Namespaces ....................................................................................... 886
Installing Packages with a Gemle .................................................................................... 886
Tutorial - Rails 4.1 .................................................................................................................. 886
Rails Development Environment Setup .............................................................................. 887
Install the EB CLI ............................................................................................................ 888
Set Up Your Git Repository .............................................................................................. 889
Congure the EB CLI ....................................................................................................... 889
Create a Service Role and Instance Prole ......................................................................... 890
Update the Gemle ........................................................................................................ 890
Deploy the Project .......................................................................................................... 890
Update the Application ................................................................................................... 893
Clean Up ....................................................................................................................... 894
Tutorial - Sinatra .................................................................................................................... 894
Prerequisites .................................................................................................................. 894
Step 1: Set Up Your Project ............................................................................................. 895
Step 2: Create an Application ........................................................................................... 896
Step 3: Create an Environment ......................................................................................... 897
Step 4: Deploy a Simple Sinatra Application