Accessing RDS from Elastic Beanstalk, cannot change secuirty groups - amazon-web-services

I am trying to access an RDS database in a VPC from elastic beanstalk. I tried adding the vpcgroup to the the security group list for elastic beanstalk, which works for a regular ec2 instance, but when I try to do this for the elastic beanstalk security group I get the following error message:
Could not update your security group rules (No changes were made): You may not define rules between a VPC group and a non-VPC group
I have also tried adding the existing security group I use for ec2, which can access the RDS database, to the elastic beanstalk instance, but when I do that it says the security group does not exist. How can I make it so that the elastic beanstalk instance has access to my RDS database? Alternatively, what do I need to put in the config.yml file so that it starts out with my prexisting security group that already has access to the RDS database / VPC?

Security groups are specific to a VPC. It appears that your Elastic Beanstalk environment is in EC2 classic instead of a VPC. The quick solution is to enable Classic Link. The more long-term solution is to rebuild your Elastic Beanstalk environment in your VPC.

To start the instance in an existing vpc you need to add the vpc and subnet to a .config file in .ebextensions. For example:
option_settings:
- namespace: aws:ec2:vpc
option_name: VPCId
value: vpc-IDhere
- namespace: aws:ec2:vpc
option_name: Subnets
value: subnet-IDhere

Related

Connecting RDS to elasticbeanstalk?

I have a application on elastic beanstalk single instance ( we have not used loadblancer ). And we also have our newly created RDS ( rds created separately, not with elastic beanstalk ). Both are in same VPC but different security group.
Now as per this tutorial from aws - check here. I have added elastic beanstalks security group to rds's group as inbound rule. Now the documentation asks to do the same on elastic beanstalk. But the problem is that, if i apply the configuration changes then it cause to terminate the instance and recreate the instance.
Am not bothering about recreating, but the problem is that it deletes all installed repos and configuration ( certbot, and other repos ). Its not good we believe.
So is there any way to connect this without adding RDS security group to elastic beanstalk security group without terminating and recreating the instance ?
Should i edit elastic beanstalks security group and add Postgres inbound rule - like i did with rds ? Please advice.

RDS database is not showing on EC2 instance

I have a RDS databse with status as Running however it is now showing in my EC2 Security Groups. The only instances showing are:
default VPC security group
Securtiy Group for Elastic Beanstalk
Elastic Beanstalk created security group
Why is the RDS database not showing in the EC2 Security Groups?
RDS settings:
enter image description here
The typical security setup would be:
A Security Group on the Amazon EC2 instances created by Elastic Beanstalk (App-SG) with adequate inbound rules for users to access the app (or perhaps from a Load Balancer -- I'll assume you have that configured correctly)
A Security Group on the Amazon RDS database (DB-SG) with an inbound rule that permits access from App-SG on the database port
That is, DB-SG should specifically reference the App-SG in its inbound rules. This will give permission for any of the EC2 instances to connect to the database.
Feel free to create new Security Groups with appropriate names and rules, then associate those Security Groups with the EC2 instances (via Elastic Beanstalk) and the database. You do not need to keep using the Default security group.

Create and assign AWS elastic Beanstalk Spring instance to VPC

I want to create 3 AWS Elastic Beanstalk instances and assign them to VPC with internal IP addresses. As you can see I have a default VPC created and running:
When I try to create a new AWS Elastic Beanstalk instance under the same Ohio region into the menu I see just see empty list of VPC:
Do you know what configuration I need to do in order to assign AWS Elastic Beanstalk instances to VPC?
EDIT:
I use this form to create VPC:
It seems like you did not select the Application Platform in Elastic Beanstalk's application creation process.
Try picking a platform before configuring more options.

LaunchWaitCondition failed. The expected number of EC2 instances were not initialized within the given time

The error message is:
Stack named 'awseb-e-r3uhxvhyz7-stack' aborted operation. Current state: 'CREATE_FAILED' Reason: The following resource(s) failed to create: [AWSEBInstanceLaunchWaitCondition].
I am trying to use Multi-Container Docker in AWS Elastic Beanstalk.
Can someone help me to get rid of this error.Is it necessary to use more than one EC2 instance for using Multi-Container Docker in AWS Elastic Beanstalk?
This sound kinda what your issue is:
If you use Amazon VPC with Elastic Beanstalk, Amazon EC2 instances deployed in a private subnet cannot communicate directly with the Internet. Amazon EC2 instances must have Internet connectivity to communicate to Elastic Beanstalk that they were successfully launched. To provide EC2 instances in a private subnet with Internet connectivity, you must add a load balancer and NAT to the public subnet. You must create the appropriate routing rules for inbound and outbound traffic through the load balancer and NAT. You must also configure the default Amazon VPC security group to allow traffic from the Amazon EC2 instances to the NAT instance.
Source: Amazon EC2 Instances Fail to Launch within the Wait Period
I've fixed this. It looks the like IAM role created by default for the single docker EB deployment didn't contain the necessary ECS Policy (unconfirmed).
I followed the instructions to create a policy to add the role and everyhing worked.

Allow EC2 Security Group access from Beanstalk Security Group

I have an Amazon Beanstalk Load Balancer setup which adds / removes ec2 servers as needed. The security group for this load balancer is called prod-sc.
I also have an Amazon EC2 instance using security group elasticsearch-sc.
Now I need elasticsearch-sc to allow port 9200 to be accessed from prod-sc
However everytime I try to configure this in the elasticsearch-sc by providing the prod-sc Group ID, I get an error saying
Could not update your security group rules (No changes were made): You may not define rules between a VPC group and a non-VPC group.
How can I give prod-sc access to elasticsearch-sc?
Can you try creating elasticsearch-sc as a VPC security group?
Read the guide for more details.
http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_SecurityGroups.html
http://docs.aws.amazon.com/cli/latest/reference/ec2/create-security-group.html