3

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?

Community
  • 1
  • 1
fblundun
  • 887
  • 5
  • 16
  • Hello, how did you manage to put the .ebextensions folder into the jar? And also, where did you put that folder inside the jar, at root? I am using spring-boot maven build. – Bahadir Tasdemir Oct 11 '16 at 14:26
  • Why not use awsebcli to create environments. You can attach a database with the --database flag. – zachdb86 Sep 14 '17 at 06:52

0 Answers0