Skip to content

Instantly share code, notes, and snippets.

@123epsilon
Created September 16, 2023 23:52
Show Gist options
  • Save 123epsilon/67f9d75a2c78a164a1cb6a1d40fe673f to your computer and use it in GitHub Desktop.
Save 123epsilon/67f9d75a2c78a164a1cb6a1d40fe673f to your computer and use it in GitHub Desktop.
AWS Elastic Beanstalk Amazon Linux 2 Django Server Commands to access Django environment via eb ssh
1) do an `eb ssh` to your instance
2) find your django app in /var/app/current/
3) to activate the venv that elastic beanstalk creates: `source /var/app/venv/staging-*/bin/activate`
4) to grab any environment variables set in the evironment configuration:
`while IFS='=' read -r name value; do export "$name"="$value"; done < /opt/elasticbeanstalk/deployment/env`
5) `python manage.py shell` or whatever you want
@123epsilon
Copy link
Author

123epsilon commented Dec 20, 2023

source /var/app/venv/staging-*/bin/activate && while IFS='=' read -r name value; do export "$name"="$value"; done < /opt/elasticbeanstalk/deployment/env && cd /var/app/current/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment