Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to specify an EC2 Security Group using the eb cli

I need to connect my Elastic Beanstalk application to an external(not created by EB) database hosted on RDS. I can do this easily in two steps: 1) Create application 2) edit configuration and add the necessary security group in the EB console

I want the correct security group to be added on startup, to avoid the possible human errors of doing it manually.

My problem is that using eb start it dynamically creates the security group. I can't figure out a way to automatically set the correct (or a second) ec2 security group that allows access to the database. The eb cli doesn't seem to allow for using saved configurations.

Is it possible using the config file? Or am I missing something?

like image 595
tnichols Avatar asked Jun 11 '13 00:06

tnichols


1 Answers

I hope this helps, create a .config on .ebextensions:

Resources:
  AWSEBSecurityGroup:
    Type: "AWS::EC2::SecurityGroup"
    Properties:
      GroupDescription: "My Own SecurityGroup for ElasticBeanstalk environment."
      SecurityGroupIngress:
        - {CidrIp: "0.0.0.0/0", IpProtocol: "tcp", FromPort: "443", ToPort: "443"}
        - {CidrIp: "0.0.0.0/0", IpProtocol: "tcp", FromPort: "80", ToPort: "80"}
like image 178
Ker Ruben Ramos Avatar answered Oct 17 '22 07:10

Ker Ruben Ramos