Using Elastic Beanstalk With Amazon RDS: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
| Line 12: | Line 12: | ||
# Add the DB instance's security group to the Elastic Beanstalk environment. | # Add the DB instance's security group to the Elastic Beanstalk environment. | ||
# Save RDS connection information in Elastic Beanstalk environment. | # Save RDS connection information in Elastic Beanstalk environment. | ||
:* Alternatively store the RDS connection string in Amazon S3 (more secure). <ref>[http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/AWSHowTo.RDS.html#rds-external-credentials Storing the Connection String in Amazon S3] - AWS Elastic Beanstalk Developers Guide</ref> | |||
# Restart the Elastic Beanstalk environment. | # Restart the Elastic Beanstalk environment. | ||
=== Grant RDS access for the Elastic Beanstalk environment === | |||
If the environment needs access to an independent RDS instance, it's necessary to add some configuration properties or else `eb deploy` will generate errors to the effect that the local development db host was not found. | |||
* [https://us-west-2.console.aws.amazon.com/elasticbeanstalk/home AWS EB console] | |||
* ''EB app'' > ''EB environment'' > '''Configuration''' > '''Instances''' | |||
** '''Instance profile:''' Add `rds-launch-wizard,` (The comma separates the new profile from existing profiles.) | |||
* ''EB app'' > ''EB environment'' > '''Configuration''' > '''Software Configuration''' > '''Environment Properties''' | |||
** `RDS_DB_NAME` | |||
** `RDS_HOSTNAME` | |||
** `RDS_PASSWORD` | |||
** `RDS_PORT` | |||
** `RDS_USERNAME` | |||
See [[Deploying_a_Django_app_on_AWS#Saving_and_restoring_Elastic_Beanstalk_environment_configurations|Saving and applying Elastic Beanstalk environment configurations]] | |||
== Migration == | == Migration == | ||
Revision as of 18:00, 17 February 2016
Overview
Notes about configuring a Django project hosted with AWS Elastic Beanstalk to use a stand-alone RDS instance for its database.
Setup
See Using Elastic Beanstalk with Amazon RDS - AWS Elastic Beanstalk Developer Guide
- In the Amazon RDS Management Console, create a new RDS instance. [1]
- Modify DB instance's security group to allow inbound traffic.
- Add the DB instance's security group to the Elastic Beanstalk environment.
- Save RDS connection information in Elastic Beanstalk environment.
- Alternatively store the RDS connection string in Amazon S3 (more secure). [2]
- Restart the Elastic Beanstalk environment.
Grant RDS access for the Elastic Beanstalk environment
If the environment needs access to an independent RDS instance, it's necessary to add some configuration properties or else eb deploy will generate errors to the effect that the local development db host was not found.
- AWS EB console
- EB app > EB environment > Configuration > Instances
- Instance profile: Add
rds-launch-wizard,(The comma separates the new profile from existing profiles.)
- Instance profile: Add
- EB app > EB environment > Configuration > Software Configuration > Environment Properties
RDS_DB_NAMERDS_HOSTNAMERDS_PASSWORDRDS_PORTRDS_USERNAME
See Saving and applying Elastic Beanstalk environment configurations
Migration
Database structure updates are managed by eb deploy automatically executing manage.py makemigrations and manage.py migrate.
See also PostgreSQL Backups and Migration
Notes
- ↑ Launching and Connecting to an External RDS - AWS Elastic Beanstalk Developers Guide
- ↑ Storing the Connection String in Amazon S3 - AWS Elastic Beanstalk Developers Guide