Skip to content

AWS VPC subnets should not allow automatic public IP assignment

Description

VPC subnet is a part of the VPC having its own rules for traffic. Assigning the Public IP to the subnet automatically (on launch) can accidentally expose the instances within this subnet to internet and should be edited to 'No' post creation of the Subnet.

Code Example

go
resource "aws_subnet" "test" {
 ...
+ map_public_ip_on_launch = false
  }

Remediation

Terraform

  • Resource: aws_subnet
  • Arguments: map_public_ip_on_launch

Rule Details

FieldValue
IDIAC-0181
SeverityLOW
IaC TypeTerraform
FrameworksTerraform, TerraformPlan
Checkov IDCKV_AWS_130

References