Skip to main content

Deploy to AWS Elastic Beanstalk

Project description

ebdeploy

A lightweight Python library for automating deployments to AWS Elastic Beanstalk.

Installation

pip install ebdeploy
# or from source:
pip install -e .

Configuration

Run the interactive setup wizard to generate .elasticbeanstalk/ebdeploy.yml:

ebdeploy init

Or copy ebdeploy.yml.example.elasticbeanstalk/ebdeploy.yml and fill in the values:

app_name: d-sights-danone               # <project>-<client>
environment: d-sights-danone-stage      # <project>-<client>-<env>
s3_bucket: elasticbeanstalk-us-east-1-089747246458
s3_prefix: d-sights/stage/danone        # <project>/<env>/<client>
aws_region: us-east-1
aws_profile: my-aws-profile             # remove to use the default profile

All parameters can be overridden with EB_* environment variables:

Variable Config field
EB_APP_NAME app_name
EB_ENVIRONMENT environment
EB_S3_BUCKET s3_bucket
EB_S3_PREFIX s3_prefix
EB_AWS_REGION aws_region
EB_AWS_PROFILE aws_profile

.ebignore

Create a .ebignore file in your project root to exclude files from the deployment archive. Uses the same glob syntax as .gitignore:

# .ebignore
tests/
*.log
docs/
.env.local

CLI

# Interactive setup
ebdeploy init
ebdeploy init --reconfigure

# Full deploy (version = git SHA)
ebdeploy deploy

# Deploy with a custom version label
ebdeploy deploy --version v1.2.3

# Dry-run (build archive only, no AWS calls)
ebdeploy deploy --dry-run

# Show environment status
ebdeploy status

# Build archive only
ebdeploy package --output deploy.zip

# Override config via CLI flags
ebdeploy deploy --profile prod-profile --environment myapp-prod

Makefile

Add to your Makefile:

.PHONY: deploy deploy-dry status

deploy:
        ebdeploy deploy

deploy-dry:
        ebdeploy deploy --dry-run

status:
        ebdeploy status

Python API

from ebdeploy import Deployer, DeployConfig

cfg = DeployConfig.auto()          # reads ebdeploy.yml + ENV
deployer = Deployer(cfg)

# Full deploy
version = deployer.deploy()

# Dry-run
deployer.deploy(dry_run=True)

# Build archive only
deployer.package(output_path="deploy.zip")

# Environment status
info = deployer.status()
print(info["Status"], info["Health"])

How it works

git rev-parse --short HEAD  →  version label (e.g. a1b2c3d)
        │
        ▼
git archive HEAD -o deploy.zip   (or zip with all files)
        │
        ▼
aws s3 cp deploy.zip s3://<bucket>/<project>/<env>/<client>/<version>.zip
        │
        ▼
aws elasticbeanstalk create-application-version
        │
        ▼
aws elasticbeanstalk update-environment
        │
        ▼
Poll every 15s → wait for Status=Ready ✓

Tests

pip install -e ".[dev]"
pytest tests/ -v

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ebdeploy-0.1.0.tar.gz (16.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ebdeploy-0.1.0-py3-none-any.whl (15.3 kB view details)

Uploaded Python 3

File details

Details for the file ebdeploy-0.1.0.tar.gz.

File metadata

  • Download URL: ebdeploy-0.1.0.tar.gz
  • Upload date:
  • Size: 16.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.8

File hashes

Hashes for ebdeploy-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7aecc426d9f7077eb2c94645e448a70397a81121bf3e73596bd5435051668ba3
MD5 d3a0f4a370db285077aa27f31d31d784
BLAKE2b-256 95f2e41a9be2633ff09f181567f68673dd01f197f3ce6ce1041570353e13125b

See more details on using hashes here.

File details

Details for the file ebdeploy-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: ebdeploy-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 15.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.8

File hashes

Hashes for ebdeploy-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 331f3855744d7ee55b2d4d6d57fae89c3b5a45ce1a999531a993d038d87ecc22
MD5 ffc3638008d7bce8d4d5d0684fc4e212
BLAKE2b-256 7ae170d972554efdaba83e633e29ab99737043d5e3761c133863793a4380ae44

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page