Cannot create a new RDS database on AWS Elastic Be

2019-04-08 16:22发布

After using eb create to create a new environment, I am unable to create a new RDS database inside my environment using AWS console. It required me to select at least at least two availability zones from a list of four.

whichever I select I get the error:

DBSubnets: Invalid option value: '["subnet-3dbb9564","subnet-b2edb199"]' (Namespace: 'aws:ec2:vpc', OptionName: 'DBSubnets'): Specify the VPC ID and make sure all subnets exist.

Using EB CLI with the following command eb create --database.engine postgres, I get a timeout.

Environment details for: iod-test
  Application name: image_of_day2
  Region: us-east-1
  Deployed Version: 642b
  Environment ID: e-u7q9j5ft2e
  Platform: 64bit Amazon Linux 2015.03 v2.0.1 running Python 2.7
  Tier: WebServer-Standard
  CNAME: iotd-test2.elasticbeanstalk.com
  Updated: 2015-09-21 19:29:37.262000+00:00
Printing Status:
INFO: createEnvironment is starting.
INFO: Using elasticbeanstalk-us-east-1-249541483051 as Amazon S3 storage bucket for environment data.
INFO: Created security group named: sg-7e948419
INFO: Environment health has transitioned to Pending. There are no instances.
INFO: Created security group named: awseb-e-u7q9j5ft2e-stack-AWSEBSecurityGroup-D0EHQ2UNQQWH
INFO: Created Auto Scaling launch configuration named: awseb-e-u7q9j5ft2e-stack-AWSEBAutoScalingLaunchConfiguration-FQZXDALSR4Z6
INFO: Created RDS database security group named: awseb-e-u7q9j5ft2e-stack-awsebrdsdbsecuritygroup-1xo7y4uzxrwgx
INFO: Creating RDS database named: aaaqgf0bktrtyg. This may take a few minutes.

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

What other options do I have. Is this a problem from AWS side?

4条回答
神经病院院长
2楼-- · 2019-04-08 16:32

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.

查看更多
Summer. ? 凉城
3楼-- · 2019-04-08 16:35

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.

查看更多
Lonely孤独者°
4楼-- · 2019-04-08 16:44

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.
查看更多
啃猪蹄的小仙女
5楼-- · 2019-04-08 16:51

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"
查看更多
登录 后发表回答