Cannot create a new RDS database on AWS Elastic Beanstalk

混江龙づ霸主 提交于 2019-12-04 07:19:09

I deployed Django application successfully using this command

eb create --database.engine postgres.

Once applied the above command you will get an error as follows

ERROR: The operation timed out. The state of the environment is unknown.

after getting this error you just git add,commit and eb deploy the project. Using this method i successfully deployed Django project to AWS my .ebextensions container commands are added below 01_packages.config

packages:
  yum:
    git: []
    libffi-devel: []
    python27-devel: []
    postgresql93: []
    postgresql93-devel: []
    gcc-c++: []

first add the above configuration and set proper wsgi path and set proper RDS configuration in your settings.py.Then add, commit and deploy.After this add the configuration below and deploy

02_python.config

container_commands:
01_migrate:
    command: "source /opt/python/run/venv/bin/activate && python /opt/python/current/app/manage.py migrate --noinput"
    leader_only: true
02_collectstatic:
    command: "source /opt/python/run/venv/bin/activate && python /opt/python/current/app/manage.py collectstatic --noinput"
    leader_only: true
99_runscript:
    command: "source /opt/python/run/venv/bin/activate && python /opt/python/current/app/manage.py runscript init_db"

I had the same error message as you when using the EB CLI but upon checking the AWS web console, it seems like the database was successfully created in the environment.

dstudeba

In regards to not being able to create the database from the Elastic Beanstalk console (your first question) it appears that this is an AWS problem. According to this post, it is a known bug that they will hopefully fix.

This looks like an issue with our console with certain RDS DB instance types We will be working on a fix, but in the meantime please try a different RDS DB instance type or use the EB CLI to create your environment with an RDS DB. Here is the link to the docs for the EB Create command with the --database option: http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/eb3-create.html

I tried with multiple instance types and was not able to create it through the console. I ended up creating a separate RDS instance and connecting to that. Here is a post that had interesting points about connecting to an existing database.

Appears that you may not have created your DBSubnets in AWS.

Have you created your DBSubnets for all relevant availability zones? as described in step 3 of the below link?

http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/AWSHowTo-vpc-rds.html#AWSHowTo-vpc-rds-subnet

Create a DB subnet group

  1. Open the Amazon RDS console at https://console.aws.amazon.com/rds/.

  2. In the navigation pane, click Subnet Groups.

  3. Click Create DB Subnet Group.

  4. Click Name, and then type the name of your DB Subnet Group.

  5. Click Description, and then describe your DB Subnet Group.

  6. Next to VPC ID, select the ID of the VPC that you created.

  7. Click the add all the subnets link in the Add Subnet(s) to this Subnet Group section.

  8. When you are finished, click Yes, Create
  9. In the confirmation window, click Close.
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!