Control: 10 Amazon EC2 should be configured to use VPC endpoints
Description
This control checks whether a service endpoint for Amazon EC2 is created for each VPC. The control fails if a VPC does not have a VPC endpoint created for the Amazon EC2 service.
To improve the security posture of your VPC, you can configure Amazon EC2 to use an interface VPC endpoint. Interface endpoints are powered by AWS PrivateLink, a technology that enables you to access Amazon EC2 API operations privately. It restricts all network traffic between your VPC and Amazon EC2 to the Amazon network. Because endpoints are supported within the same Region only, you cannot create an endpoint between a VPC and a service in a different Region. This prevents unintended Amazon EC2 API calls to other Regions.
Remediation
To remediate this issue, you can create an interface VPC endpoint to Amazon EC2.
To create an interface endpoint to Amazon EC2 from the Amazon VPC console
- Open the Amazon VPC console.
- In the navigation pane, choose
Endpoints
. - Choose
Create Endpoint
. - For
Service category
, chooseAWS services
. - For
Service Name
, choosecom.amazonaws.
region.ec2
. - For
Type
, chooseInterface
. - Complete the following information.
- For
VPC
, select a VPC in which to create the endpoint. - For
Subnets
, select the subnets (Availability Zones) in which to create the endpoint network interfaces. Not all Availability Zones are supported for all AWS services. - To enable private DNS for the interface endpoint, select the check box for
Enable DNS Name
. This option is enabled by default. - To use the private DNS option, the following attributes of your VPC must be set to true:
enableDnsHostnames
enableDnsSupport
- For more information, see Viewing and updating DNS support for your VPC in the Amazon VPC User Guide.
- For
Security group
, select the security groups to associate with the endpoint network interfaces. - (Optional) Add or remove a tag. To add a tag, choose
Add tag
and do the following:- For
Key
, enter the tag name. - For
Value
, enter the tag value.
- For
- To remove a tag, choose the delete button (x) to the right of the tag
Key
andValue
.
- For
- Choose
Create endpoint
.
To create an interface VPC endpoint policy
You can attach a policy to your VPC endpoint to control access to the Amazon EC2 API. The policy specifies the following:
- The principal that can perform actions
- The actions that can be performed
- The resource on which the actions can be performed
Usage
Run the control in your terminal:
powerpipe control run aws_compliance.control.foundational_security_ec2_10
Snapshot and share results via Turbot Pipes:
powerpipe loginpowerpipe control run aws_compliance.control.foundational_security_ec2_10 --share
SQL
This control uses a named query:
vpc_configured_to_use_vpc_endpoints