First Elastic Beanstalk Deploy for Python¶
This tutorial explains the first deployment workflow for a Python Flask app on AWS Elastic Beanstalk. It follows the EB CLI sequence documented in AWS getting started guidance.
Prerequisites¶
- Completed local app setup from 01-local-run.md.
- AWS CLI and EB CLI installed.
- An initialized AWS profile (
aws configure) with masked account context. - Source project includes
application.py,requirements.txt, and optionalProcfile.
What You'll Build¶
You will create:
- An Elastic Beanstalk application definition.
- A web server environment for Python.
- An application version deployed from your source bundle.
- A baseline health and status check routine.
Steps¶
- Initialize EB metadata in your project.
- Create an environment (example names only).
export APP_NAME="eb-python-guide"
export ENV_NAME="eb-python-guide-dev"
export REGION="ap-northeast-2"
eb create "$ENV_NAME" --single
- Deploy current source as a new application version.
- Check environment status and health.
- Open environment endpoint.
Source bundle expectations from AWS docs:
- Application source files are packaged as an application version.
.elasticbeanstalk/stores CLI project configuration..ebextensions/and.platform/are included when present.
flowchart LR
A[Local Project] --> B[eb init]
B --> C[eb create]
C --> D[Environment Resources]
D --> E[eb deploy]
E --> F[Application Version Deployed]
F --> G[eb status and eb health] Verification¶
Validate deployment without assuming production traffic:
eb status "$ENV_NAME"
eb events "$ENV_NAME" --follow
aws elasticbeanstalk describe-environments --application-name "$APP_NAME" --region "$REGION"
Expected checks:
- Environment shows
Readyand healthGreenafter successful deploy. - Event stream shows successful application version deployment.
- Environment URL returns your Flask response.
If health is not green, inspect logs in the next tutorial.