Security groups

Now that we have created the basic VPC structure, let's go ahead and create security groups. We need the following security groups:

  • lambdaSecurityGroup: It should allow all outgoing traffic. This is to be attached to the lambda functions.
  • databaseSecurityGroup: It should allow incoming traffic on port 5432 only from the lambdaSecurityGroup previously created.

Following code snippet shows the creation of the security groups:

  lambdaSecurityGroup:    Type: AWS::EC2::SecurityGroup    Properties:      GroupDescription: Security Group for Lambda      VpcId:        Ref: letsPollVPC      Tags:          - Key: Name            Value: Lambda Security group  databaseSecurityGroup:    Type: AWS::EC2::SecurityGroup    Properties:      GroupDescription: Security Group for database      VpcId: Ref: ...

Get Hands-On Serverless Applications with Kotlin now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.