CloudWiki
Rules
Low

Lambda functions should be in a VPC

Security & Compliance
Description

Lambda functions should be in a VPC is a security best practice to restrict access to the function and its resources. By placing the function within a VPC, network traffic to and from the function is controlled using security groups and network access control lists (ACLs). This ensures that the function can only access the necessary resources and services within the VPC, reducing the risk of unauthorized access and potential data breaches.

Remediation

To remediate Lambda functions that are not in a VPC, the following steps can be taken:

  1. Go to the AWS Management Console and select the Lambda service.
  2. Identify the Lambda function(s) that are not in a VPC.
  3. Click on the function name to open the function configuration page.
  4. Scroll down to the Network settings section and click on the Edit button.
  5. Select the VPC and subnet(s) where you want to place the Lambda function.
  6. If necessary, update the security group(s) to allow the Lambda function to access any resources it needs.
  7. Click on the Save button to apply the changes.

Once the Lambda function is running inside the VPC, it will be able to access resources within the VPC, such as RDS instances or Elasticache clusters. However, note that the Lambda function will no longer have internet access by default, so you may need to configure a NAT gateway or VPC endpoint to allow it to access external resources.

Enforced Resources
Note: Remediation steps provided by Lightlytics are meant to be suggestions and guidelines only. It is crucial to thoroughly verify and test any remediation steps before applying them to production environments. Each organization's infrastructure and security needs may differ, and blindly applying suggested remediation steps without proper testing could potentially cause unforeseen issues or vulnerabilities. Therefore, it is strongly recommended that you validate and customize any remediation steps to meet your organization's specific requirements and ensure that they align with your security policies and best practices.