Skip to main content

aws_vpc_endpoints Resource

Use the aws_vpc_endpoints InSpec audit resource to test properties of some or all AWS VPC Endpoints.

VPC Endpoints can be of two types: ‘Gateway’ and ‘Interface’.

A Gateway type VPC endpoint accepts a route-table whereas an Interface type VPC endpoint takes one or more subnets and one or more security groups. Hence their properties might differ based on the type.

For additional information, including details on parameters and properties, see the AWS documentation on VPC Endpoints.

Install

This resource is available in the Chef InSpec AWS resource pack.

For information on configuring your AWS environment for Chef InSpec and creating an InSpec profile that uses the InSpec AWS resource pack, see the Chef InSpec documentation on the AWS cloud platform.

Syntax

Ensure that one or more VPC Endpoints exist.

describe aws_vpc_endpoints do
  it { should exist }
end

An aws_vpc_endpoints resource block uses an optional filter to select a group of VPC Endpoints and then tests that group.

Parameters

This resource does not require any parameters.

Properties

vpc_endpoint_ids
This property provides a list of the VPC Endpoint IDs that the matched VPC Endpoints serve as strings.
vpc_endpoint_types
The type of the VPC Endpoint for the match VPC Endpoints.
vpc_ids
The IDs of the VPCs in which the endpoints reside.
service_names
The names of the services that the VPC endpoint is assigned with .
states
The states of the VPC Endpoints.
route_table_ids
The route table IDs for the Gateway type endpoints.
subnet_ids
The subnet IDs for the Interface type endpoints.
tags
A hash of key-value pairs corresponding to the tags associated with the entity.
private_dns_enabled
Boolean value for Private DNS enable status.

Examples

Ensure a VPC has VPC Endpoints.

describe aws_vpc_endpoints.where( vpc_id: vpc-12345678 )
  it { should exist }
end

Match count of VPC Endpoints of Gateway type in a particular VPC.

describe aws_vpc_endpoints.where( vpc_id: vpc-12345678 ).where(vpc_endpoint_type: "Gateway") do
    its('count') { should eq 4 }
end

Check tags .

describe aws_vpc_endpoints do
  its('tags') { should include(:Environment => 'env-name',
                               :Name => 'vpce-name')}
end

Matchers

For a full list of available matchers, see our Universal Matchers page.

This resource has the following special matchers.

exist

The control will pass if the describe returns at least one result.

Use should_not to test the entity should not exist.

describe aws_vpc_endpoints do
  it { should exist }
end
describe aws_vpc_endpoints.where( <property>: <value>) do
  it { should_not exist }
end

AWS Permissions

Your Principal will need the EC2:Client:DescribeVpcEndpointsResult action with Effect set to Allow.

You can find detailed documentation at Actions, Resources, and Condition Keys for Amazon EC2.

Edit this page on GitHub

Thank you for your feedback!

×









Search Results