Cloud Defense Logo

Products

Solutions

Company

Book A Live Demo

Rule: Lambda Functions Should Be in a VPC

Ensure all Lambda functions are deployed within a Virtual Private Cloud (VPC) for enhanced security and control.

RuleLambda functions should be in a VPC
FrameworkNIST 800-53 Revision 5
Severity
Low

Rule Description:

According to NIST 800-53 Revision 5, lambda functions should be configured to run within a Virtual Private Cloud (VPC) for enhanced security and isolation. Running lambda functions in a VPC allows you to control network access and ensure secure communication between resources.

Troubleshooting Steps:

If you encounter any issues related to running lambda functions in a VPC, follow these troubleshooting steps:

  1. 1.

    Verify Lambda VPC Configuration: Double-check that the lambda function is configured to use the correct VPC settings. Ensure that the VPC, subnets, and security groups associated with the lambda function are properly configured.

  2. 2.

    Subnet Availability: Check if the subnets associated with the lambda function are available and have enough IP addresses for function execution. You may need to adjust the subnet size or create additional subnets if necessary.

  3. 3.

    Routing Issues: Validate the routing configuration within the VPC. Ensure that the lambda function's subnet route tables are properly configured, allowing access to necessary resources such as internet gateways or NAT gateways.

  4. 4.

    Security Group Settings: Review the security group rules applied to the lambda function. Check if the necessary inbound and outbound rules are defined to allow required network traffic.

  5. 5.

    VPC Endpoint Setup: If the lambda function needs to communicate with AWS services within the same region, ensure that VPC endpoints are configured to enable private connectivity without utilizing the internet gateway.

  6. 6.

    Network Access Control Lists (ACLs): Check the network ACLs associated with the subnets to ensure that there are no restrictive rules blocking necessary communication for the lambda function.

  7. 7.

    DNS Resolution: Verify if DNS resolution is enabled for the VPC. Lambda functions may require DNS resolution to interact with other AWS services or external resources.

Necessary Codes:

For configuring a lambda function to run within a VPC, you can use the AWS Command Line Interface (CLI) or AWS SDKs. Here is an example of a CLI command to create a lambda function within a VPC:

aws lambda create-function --function-name <function-name> --runtime <runtime> --role <execution-role-arn> --handler <function-handler> --code <function-code-location> --vpc-config SubnetIds=<subnet-ids>,SecurityGroupIds=<security-group-ids>

Make sure to replace the placeholders with the actual values specific to your environment. The

--vpc-config
parameter allows you to specify the subnet IDs and security group IDs associated with the lambda function.

Step-by-Step Guide for Remediation:

To ensure that your lambda functions are in a VPC as per NIST 800-53 Revision 5, follow these step-by-step instructions:

  1. 1.

    Create or Identify VPC: If you don't have an existing VPC, create a new VPC or identify the VPC you want to use for running lambda functions. Ensure that the VPC meets your network requirements.

  2. 2.

    Setup Subnets: Create or identify the subnets within the VPC where you want to run the lambda functions. Ensure that the subnets have correct IP availability and cover the desired availability zones.

  3. 3.

    Create Security Groups: Define the security groups that will control inbound and outbound traffic for the lambda function within the VPC. Consider the necessary access requirements for the function.

  4. 4.

    Configure VPC Endpoints (Optional): If your lambda function needs to access AWS services within the same region without going over the public internet, configure VPC endpoints for those services.

  5. 5.

    Update Lambda Function Configuration: Use the AWS Management Console, AWS CLI, or SDKs to update the lambda function configuration. Specify the VPC, subnets, and security groups that you created or identified earlier.

  6. 6.

    Test Lambda Function: Deploy a test version of the lambda function within the VPC and execute test events to ensure it works as expected. Monitor the function's execution and troubleshoot any issues encountered.

  7. 7.

    Update Existing Lambda Functions (if applicable): If you have existing lambda functions running outside the VPC, evaluate the impact and feasibility of migrating them into the VPC. Follow similar steps as mentioned above to update their configurations.

By following these steps, you will successfully configure and run your lambda functions within a VPC, meeting the requirements of NIST 800-53 Revision 5.

Is your System Free of Underlying Vulnerabilities?
Find Out Now