3

I'm trying to create a Elastic Bean Enviromnemnt with a RDS database attached to it. I'm using a command like this:

aws elasticbeanstalk create-environment --application-name $AWS_APP_NAME \
        --environment-name $AWS_APP_ENV_NAME \
        --tier Name=WebServer,Type=Standard \
        --solution-stack-name "64bit Amazon Linux 2 v3.2.3 running Docker" \
        --option-settings "Namespace=aws:rds:dbinstance,OptionName=DBAllocatedStorage,Value=10" \
                          "Namespace=aws:rds:dbinstance,OptionName=DBDeletionPolicy,Value=Snapshot" \
                          "Namespace=aws:rds:dbinstance,OptionName=DBEngine,Value=postgres" \
                          "Namespace=aws:rds:dbinstance,OptionName=DBEngineVersion,Value=12.5" \
                          "Namespace=aws:rds:dbinstance,OptionName=DBInstanceClass,Value=db.t2.micro" \
                          "Namespace=aws:rds:dbinstance,OptionName=DBUser,Value=devsensei" \
                          "Namespace=aws:rds:dbinstance,OptionName=DBPassword,Value=$DB_PASSWORD" \
                          "Namespace=aws:rds:dbinstance,OptionName=DBSnapshotIdentifier,Value=" \
        --region eu-west-1

The environment gets created, without any hint of an error. However, not RDS database is created. In the AWS Elastic Beans Web Console the configuration for the Database stays empty:

Empty Database Config

I've found existing StackOverflow questions, with a similar issue, like this one. One suggestion is to configure the RDS database via a .ebextensions/01-database.conf configuration in the application. Also the official AWS Elasticbeanstalk documentation (bottom of page) seems to suggest that.

I added a .ebextensions/01-database.conf to my app. Without any success. The app deploys, I see not error, but there is no RDS instance created.

option_settings:
  aws:rds:dbinstance:
    DBAllocatedStorage: 10
    DBDeletionPolicy: Snapshot
    DBEngine: postgres
    DBEngineVersion: 12.5
    DBInstanceClass: db.t2.micro
    DBUser: devuser
    DBPassword: hello-fun-4

I could configure other things with the aws elasticbeanstalk create-environment. I can create the RDS instance with the AWS Elasticbeans web console. I'm only failing to create it via the command line in an automated fashion.

Marcin
  • 215,873
  • 14
  • 235
  • 294
Gamlor
  • 12,978
  • 7
  • 43
  • 70
  • 1
    I will have a look at at the issue later, but generally using rds in EB like this is not a good practice. Usually you would create RDS fully separately. Are you sure that you want to create rds as part of your EB env? – Marcin Jan 18 '21 at 21:25
  • 2
    @marcin Yes, my fallback plan is to create the RDS instance separately. I just saw that EB supports creating and connecting a RDS instance directly, so I though that is the official recommended way to go. – Gamlor Jan 19 '21 at 04:58
  • 1
    The issue with using bundled RDS is that it will get destroyed when you delete your EB environment. It may be good if you are just using it for temporary testing or development. – Marcin Jan 19 '21 at 05:01
  • 1
    @marcin Good point, that tying the AWS RDS to ElasticBeanstalk might not be the best idea. I will go down a path where I set up RDS independent of ElasticBeanstalk – Gamlor Jan 19 '21 at 07:30
  • That's usually the preferred way. – Marcin Jan 19 '21 at 09:10
  • 1
    I did some tests on my own, and I think its not supported for AWS CLI. You can do this with EB CLI and console, but not regular CLI. This seems to be the long standing issue, as found old question about this as well [here](https://stackoverflow.com/questions/25946723/aws-cli-create-rds-with-elasticbeanstalk-create-environment). – Marcin Jan 20 '21 at 07:29
  • 1
    @marcin Yes, if found that issue. Its explicitly mentioned it my issue. Some of the guides there are mentioned to not work anymore as well. I though there is maybe something else I missed. Anyway, will do RDS setup separately. – Gamlor Jan 20 '21 at 08:00
  • 2
    3 years later, it's still an issue. *The app deploys, I see no error, but there is no RDS instance created.* – Jarad Jul 15 '21 at 00:56

0 Answers0