Bedrock AgentCore custom code interpreters should use a private network configuration
Checks that an Amazon Bedrock AgentCore custom code interpreter uses VPC network mode; PUBLIC and SANDBOX both fail. In VPC mode the code runs behind network interfaces in your subnets, so security groups, network ACLs and VPC flow logs govern what it can reach.
- service
- BedrockAgentCore
- severity
- High
- scope
- evaluated in every region
How to fix it
- Replaces the resource: A code interpreter's network mode is fixed at creation: create a VPC one, repoint the agents that open sessions on it, then delete this one.
In the console
Bedrock AgentCore → Built-in tools → Create Code Interpreter tool → Network settings (fixed at creation)
- Network settings
- VPC
- Subnets
- Private subnets in Availability Zones that AgentCore supports, with a NAT gateway only if the code calls the internet
- Security groups
- Outbound rules for only what the code needs; moving off SANDBOX, these now set its reach into your VPC
- Permissions
- The flagged interpreter's execution role, if it has one
With the AWS CLI
aws bedrock-agentcore-control create-code-interpreter --name <code-interpreter-name> --network-configuration '{"networkMode":"VPC","vpcConfig":{"subnets":["<subnet-id>"],"securityGroups":["<security-group-id>"]}}' --region <region>With Terraform
- Interrupts service: Changing network_mode on an interpreter Terraform already tracks replaces it in one apply that deletes the old one first, so agents lose it until they are repointed.
resource "aws_bedrockagentcore_code_interpreter" "this" {
name = var.code_interpreter_name
network_configuration {
network_mode = "VPC"
vpc_config {
security_groups = var.security_group_ids
subnets = var.subnet_ids
}
}
}
See which of your accounts this check is failing on.
Book a live scan