Using the AWS Management Console UI, I can easily configure Elastic Beanstalk to create an RDS database when creating an environment.
I want to automate this process using Boto. It is apparently impossible to create and attach the RDS instance just using Boto or the CLI, so I have instead added a .ebextensions directory in the root of my jar. It contains a file called "01-rds.config" containing this YAML (copied from here):
Resources: AWSEBRDSDatabase: Type: AWS::RDS::DBInstance Properties: AllocatedStorage: 5 DBInstanceClass: db.t2.micro DBName: myawesomeapp Engine: postgres EngineVersion: 9.4.4 MasterUsername: myAwesomeUsername MasterUserPassword: myCrazyPassword
This does cause Beanstalk to create a database with the specified username and password. However, when I try to use the application, I get 502 Bad Gateway
.
In the "Data Tier" section of the console, I can see an RDS entry, but it only displays the following information about the database:
- Engine
- Instance class
- Storage
- Multi Availability Zone
- When the environment is deleted
In contrast, when I create the environment and configure the RDS database using the console, this section also contains the Endpoint for the RDS instance.
What's going on? Is the elastic beanstalk environment somehow unable to access the database?