EC2 Instance In VPC High

EC2 instance does not belong to a virtual private cloud (VPC). Ensure Amazon Elastic Compute Cloud (Amazon EC2) instance belong to a virtual private cloud (VPC).

Detector ID
cloudformation/checkov-custom-ec2-instances-in-vpc@v1.0
Category
Common Weakness Enumeration (CWE) external icon
-

Noncompliant example

1Resources:
2  ExampleEC2:
3    Type: AWS::EC2::Instance
4    Properties:
5      # Noncompliant: This EC2 instance does not belong to a virtual private cloud (VPC).
6      ImageId: !Ref LatestAmiId
7      InstanceType: !Ref pInstanceType
8      IamInstanceProfile: !Ref rInstanceProfile

Compliant example

1Resources:
2  ExampleEC2:
3    Type: AWS::EC2::Instance
4    Properties:
5      ImageId: !Ref LatestAmiId
6      InstanceType: !Ref pInstanceType
7      IamInstanceProfile: !Ref rInstanceProfile
8      # Compliant: This EC2 instance belongs to a virtual private cloud (VPC).
9      SubnetId: !Ref pSubnetId