Installation in an Amazon Web Services VPC
This guide will walk you through the process of configuring the CARTO Analytics Toolbox to work within a VPC with a CARTO Self-hosted installation on Amazon Web Services.
Overview
When deploying the Analytics Toolbox in a VPC environment with CARTO Self-hosted, you need to:
Set up the VPC infrastructure (subnet, security group, VPC endpoint)
Create IAM roles with VPC access permissions
Run the Analytics Toolbox installer with the pre-configured roles
Update the Lambda functions with VPC configuration
Configure DNS for the CARTO Self-hosted platform
Configure the AT Gateway
Architecture overview
To deploy the Analytics Toolbox within a VPC, the following infrastructure pieces are needed:

One subnetwork used to deploy the containers created by the Lambda function
Lambda functions for Redshift to interact with the Self-hosted platform
An internal DNS record pointing to the IP address of your CARTO Self-hosted platform
A VPC endpoint to allow communication between your Redshift instance and the VPC where CARTO Self-Hosted platform is installed
Step 1: Prepare VPC Infrastructure
Before running the installer, you need to set up the networking infrastructure that the Lambda functions will use.
1.1 Create a subnet for the Lambda function
Replace the following:
VPC_NETWORK: the ID of the network created in your VPC projectSUBNETWORK_IPS_RANGE: the range of IPs that this subnetwork will use
REGION: the region used to create the subnetworkSUBNETWORK_NAME: the name of the subnetwork that will be created
Save the Subnet ID from the output for later use.
1.2 Create a security group for the Lambda function
Replace the following:
GROUP_NAME: the name of the security groupREGION: the region used to create the security groupVPC_NETWORK: the ID of the network created in your VPC project
Save the Security Group ID from the output for later use.
1.3 Provision a VPC endpoint for Lambda
Replace the following:
VPC_NETWORK: the ID of the network created in your VPC projectREGION: the region used to create the VPC endpointSECURITY_GROUP_ID: ID of the security group created in the previous step
Step 2: Create IAM Role for Lambda with VPC Access
Create a Lambda execution role that has permissions to access VPC resources.
2.1 Create the Lambda execution role
ROLE_NAME: Name of the role (e.g.,CartoATLambdaVPCRole)
The lambda-trust-policy.json file should contain:
2.2 Attach VPC execution permissions to the role
ROLE_NAME: Name of the role created in the previous step
Save the Role ARN for use with the installer.
Step 3: Configure Security Groups
Ensure that the security groups allow traffic between the Lambda function and the CARTO Self-hosted environment.
The CARTO Self-hosted platform must be accessible through port 443, and it should allow responses to requests from the Lambda function deployed in the previous steps.
All requests will be handled inside the VPC, so all network traffic will occur between the created subnetwork and the CARTO Self-hosted instance.
Step 4: Create DNS Entry for CARTO Self-hosted Platform
The Lambda functions need to access the CARTO Self-hosted LDS API. Since requests are handled inside the VPC, you need an internal DNS entry for the Lambda functions to reach the CARTO platform APIs.
First, obtain the internal IP address of the CARTO Self-hosted platform.
If you already have an internal DNS configured in your AWS project, you can skip creating a new hosted zone and directly add a new record pointing to the CARTO platform internal IP address.
4.1 Create a DNS zone (if needed)
DNS_ZONE: the name of your DNS zoneREGION: region where the zone is going to be createdVPC_ID: your AWS VPC ID
4.2 Create a DNS record pointing to CARTO Self-hosted
Replace the following:
DNS_ZONE_ID: the ID of your DNS zoneINTERNAL_DOMAIN: the internal domain that will point to your CARTO Self-hosted deployment inside your VPCCARTO_PLATFORM_IP: internal IP address of your CARTO Self-hosted deployment
Step 5: Run the Analytics Toolbox Installer
Now that the VPC infrastructure is ready, run the Analytics Toolbox installer with the pre-created Lambda execution role.
5.1 Extract and prepare the installer
5.2 Run the installer with the VPC-enabled role
Replace the following:
REGION: the AWS region where your Redshift cluster is deployedLAMBDA_PREFIX: prefix for Lambda function names (e.g.,carto-at-vpc-)LAMBDA_ROLE_ARN: ARN of the Lambda execution role created in Step 2REDSHIFT_HOST: your Redshift cluster endpointREDSHIFT_DATABASE: your Redshift database nameREDSHIFT_USER: Redshift admin usernameREDSHIFT_PASSWORD: Redshift admin password
Step 6: Update Lambda Functions with VPC Configuration
After the installer completes, you need to update the deployed Lambda functions with VPC configuration so they can access your CARTO Self-hosted platform.
6.1 List the deployed Lambda functions
The installer creates Lambda functions with your specified prefix. List them to get the function names:
6.2 Update each Lambda function with VPC configuration
For each Lambda function, run:
Replace the following:
LAMBDA_FUNCTION_NAME: name of the Lambda function to updateSUBNET_ID: ID of the subnet created in Step 1.1SECURITY_GROUP_ID: ID of the security group created in Step 1.2REGION: AWS region
6.3 Update Lambda retry configuration
For each Lambda function, disable retries to prevent duplicate operations:
Step 7: Configure the AT Gateway
Now configure the Analytics Toolbox to use the deployed Lambda functions for LDS and other gateway functionalities.
Connect to your Redshift database and run the SETUP procedure:
Replace the following:
LAMBDA_FUNCTION_NAME: name of the AT Gateway Lambda function (with your prefix, e.g.,carto-at-vpc-lds)REDSHIFT_INVOKE_ROLE_ARN: ARN of the role created by the installer to allow Redshift to invoke Lambda (check your Redshift cluster's associated IAM roles)API_BASE_URL: the API base URL of your CARTO Self-hosted platformAPI_ACCESS_TOKEN: access token generated inside CARTO platform with permissions to use the LDS API
Congratulations!
Your CARTO Analytics Toolbox is now successfully installed and configured inside your VPC.
Now you can start using the functions in the SQL reference
Last updated
Was this helpful?

