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: myproject-client               # <project>-<client>
environment: myproject-client-stage      # <project>-<client>-<env>
s3_bucket: mybucket
s3_prefix: myproject/stage/client        # <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.4.tar.gz (20.4 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.4-py3-none-any.whl (17.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ebdeploy-0.1.4.tar.gz
  • Upload date:
  • Size: 20.4 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.4.tar.gz
Algorithm Hash digest
SHA256 f6d6f8601080baae8dcf53e19227bb0b39b2844c7221dff351523d81be51da54
MD5 acd94ec673f733ccd58e7a2eda61ab9c
BLAKE2b-256 e4e24f5aa39199f15af251f8bf4f644e32f82aad0ffee789ee8466517a8f45d9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ebdeploy-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 17.0 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 551562aca3c081d236eec159bfa7fe0d17049188538da26070bddb4a1ab3d9fb
MD5 ebe46a2e6b59dcdb6c575d801292f702
BLAKE2b-256 52650474da607b4b775b6d84176e12651556902863cfcda91e4b1432aab0e38c

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