Skip to content

Why does setting up AWS security feel like swimming upstream?

0

ust a simple thing like storing MySQL connectionstring in a parameterStore secure variable is a major PIA:

Since our RDS MySQL is in a VPC, my Lambda needs to be there also - then you need to setup VPC endpoint for SSM, which requires security group - and it's really "fun" trying to figure out which security settings it needs - and when I try to add self-ingress rule for 443 in the security group - it says maximum number of rules reached for the security group. Most of the time AWS error messages are not useful either - when it just says: "Endpoint request timed out"

Should I just put the connectionstring in Lambda code, or is there a way to figure this out?

asked 2 years ago240 views

2 Answers
0
  1. The security group on the VPC endpoint just needs 443 Inbound from the Lambda SG or CIDR Range. I usually allow VPC Cidr range here
  2. The Lambda security group can be left as 0.0.0.0/0 ANY Outbound or you could limit it ifyou wish
  3. On your RDS security group allow Inbound on 3306 from the Lambda Security group
  4. Last option, If you have a NAT gateway on the VPC you can just let lambda use SSM parameter store over the public internet too.

It just comes down to knowledge and experience with any kind of techonology I am afraid.

EXPERT

answered 2 years ago

EXPERT

reviewed 2 years ago

0

All general AWS service endpoints both on the public internet and as VPC interface endpoints only require HTTPS (tcp/443) inbound. In your case, you should have one security group for the Lambda function and another security group for your VPC endpoints for AWS services.

In the outbound/egress rules of the Lambda function's security group, permit TCP to port 443 towards the security group ID of the AWS service endpoints, unless all outbound traffic to 0.0.0.0/0 is already permitted.

In the inbound/ingress rules of the AWS service endpoint security group, permit TCP to port 443 from the security group ID of the Lambda function.

As an alternative to having a static password for authenticating to your database, you could also use IAM authentication with the Lambda function's temporary IAM credentials: https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/UsingWithRDS.IAMDBAuth.html. You'll still need an endpoint, in this case for the RDS service in your region, but no static password to safeguard would be needed by your Lambda function.

EXPERT

answered 2 years ago

EXPERT

reviewed 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.