π AWS VPC is not configured with a VPC Endpoint for Amazon EC2 service π’
- Contextual name: π VPC is not configured with a VPC Endpoint for Amazon EC2 service π’
- ID:
/ce/ca/aws/vpc/no-ec2-vpc-endpoint
- Located in: π AWS VPC
Flagsβ
- π’ Policy with categories
- π’ Policy with type
- π’ Production policy
Our Metadataβ
- Policy Type:
COMPLIANCE_POLICY
- Policy Category:
SECURITY
Similar Policiesβ
- AWS Security Hub
- [[EC2.10] Amazon EC2 should be configured to use VPC endpoints that are created for the Amazon EC2 service]([EC2.10] Amazon EC2 should be configured to use VPC endpoints that are created for the Amazon EC2 service (https://docs.aws.amazon.com/securityhub/latest/userguide/ec2-controls.html#ec2-10)]
Logicβ
- π§ prod.logic.yaml π’
- π AWS VPC
- π AWS VPC Endpoint - object.extracts.yaml
- π§ͺ test-data.json
Descriptionβ
Descriptionβ
Ensures that Amazon VPCs are configured with a VPC endpoint for the Amazon EC2 service. A VPC endpoint enables private connectivity between your VPC and supported AWS services without the need for an internet gateway, NAT device, VPN connection, or AWS Direct Connect.
Rationaleβ
Using VPC endpoints for services such as EC2 enhances security by ensuring all traffic between your VPC and the EC2 service remains within the AWS network. This prevents data exposure to the public internet, reducing the risk of interception and external attacks. Additionally, it improves reliability and helps maintain consistent network performance.
Impactβ
Provisioning VPC endpoints may result in additional costs. Charges apply for each hour an interface VPC endpoint is active in an Availability Zone, as well as per GB of data processed.
Auditβ
This policy flags an AWS VPC as
INCOMPLIANT
if it contains at least one EC2 Instance but does not contain an active VPC Endpoint withEndpoint Service ID
set to ec2.... see more
Remediationβ
Remediationβ
From Command Lineβ
Create the VPC Endpointβ
aws ec2 create-vpc-endpoint \
--vpc-id {{vpc-id}} \
--service-name com.amazonaws.{{region}}.ec2 \
--subnet-ids {{subnet-id1}} {{subnet-id2}} \
--security-group-ids {{security-group-id}}Using CloudFormationβ
- CloudFormation template (YAML):
AWSTemplateFormatVersion: 2010-09-09
Description: Create EC2 VPC Endpoint
Parameters:
VpcId:
Type: String
Description: The ID of the VPC where the endpoint will be created.
SubnetIds:
Type: CommaDelimitedList
Description: Comma-separated list of subnet IDs for the VPC endpoint.
SecurityGroupIds:
Type: CommaDelimitedList
Description: Comma-separated list of security group IDs to associate with the VPC endpoint.
Resources:
EC2VpcEndpoint:
Type: AWS::EC2::VPCEndpoint
Properties:
VpcId: !Ref VpcId
ServiceName: !Sub "com.amazonaws.${AWS::Region}.ec2"
SubnetIds: !Ref SubnetIds
SecurityGroupIds: !Ref SecurityGroupIds
Outputs:
VpcEndpointId:
Description: The ID of the created VPC endpoint
... [see more](remediation.md)