Vpc Endpoint Args
Provides a VPC Endpoint resource.
NOTE on VPC Endpoints and VPC Endpoint Associations: The provider provides both standalone VPC Endpoint Associations for Route Tables - (an association between a VPC endpoint and a single
route_table_id
), Security Groups - (an association between a VPC endpoint and a singlesecurity_group_id
), and Subnets - (an association between a VPC endpoint and a singlesubnet_id
) and a VPC Endpoint resource withroute_table_ids
andsubnet_ids
attributes. Do not use the same resource ID in both a VPC Endpoint resource and a VPC Endpoint Association resource. Doing so will cause a conflict of associations and will overwrite the association.
Example Usage
Basic
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ec2.VpcEndpoint;
import com.pulumi.aws.ec2.VpcEndpointArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var s3 = new VpcEndpoint("s3", VpcEndpointArgs.builder()
.vpcId(aws_vpc.main().id())
.serviceName("com.amazonaws.us-west-2.s3")
.build());
}
}
Basic w/ Tags
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ec2.VpcEndpoint;
import com.pulumi.aws.ec2.VpcEndpointArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var s3 = new VpcEndpoint("s3", VpcEndpointArgs.builder()
.vpcId(aws_vpc.main().id())
.serviceName("com.amazonaws.us-west-2.s3")
.tags(Map.of("Environment", "test"))
.build());
}
}
Interface Endpoint Type
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ec2.VpcEndpoint;
import com.pulumi.aws.ec2.VpcEndpointArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var ec2 = new VpcEndpoint("ec2", VpcEndpointArgs.builder()
.vpcId(aws_vpc.main().id())
.serviceName("com.amazonaws.us-west-2.ec2")
.vpcEndpointType("Interface")
.securityGroupIds(aws_security_group.sg1().id())
.privateDnsEnabled(true)
.build());
}
}
Gateway Load Balancer Endpoint Type
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.AwsFunctions;
import com.pulumi.aws.ec2.VpcEndpointService;
import com.pulumi.aws.ec2.VpcEndpointServiceArgs;
import com.pulumi.aws.ec2.VpcEndpoint;
import com.pulumi.aws.ec2.VpcEndpointArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
final var current = AwsFunctions.getCallerIdentity();
var exampleVpcEndpointService = new VpcEndpointService("exampleVpcEndpointService", VpcEndpointServiceArgs.builder()
.acceptanceRequired(false)
.allowedPrincipals(current.applyValue(getCallerIdentityResult -> getCallerIdentityResult.arn()))
.gatewayLoadBalancerArns(aws_lb.example().arn())
.build());
var exampleVpcEndpoint = new VpcEndpoint("exampleVpcEndpoint", VpcEndpointArgs.builder()
.serviceName(exampleVpcEndpointService.serviceName())
.subnetIds(aws_subnet.example().id())
.vpcEndpointType(exampleVpcEndpointService.serviceType())
.vpcId(aws_vpc.example().id())
.build());
}
}
Import
VPC Endpoints can be imported using the vpc endpoint id
, e.g.,
$ pulumi import aws:ec2/vpcEndpoint:VpcEndpoint endpoint1 vpce-3ecf2a57
Constructors
Properties
Accept the VPC endpoint (the VPC endpoint and service need to be in the same AWS account).
The DNS options for the endpoint. See dns_options below.
The IP address type for the endpoint. Valid values are ipv4
, dualstack
, and ipv6
.
A policy to attach to the endpoint that controls access to the service. This is a JSON formatted string. Defaults to full access. All Gateway
and some Interface
endpoints support policies - see the relevant AWS documentation for more details.
Whether or not to associate a private hosted zone with the specified VPC. Applicable for endpoints of type Interface
. Defaults to false
.
One or more route table IDs. Applicable for endpoints of type Gateway
.
The ID of one or more security groups to associate with the network interface. Applicable for endpoints of type Interface
. If no security groups are specified, the VPC's default security group is associated with the endpoint.
The service name. For AWS services the service name is usually in the form com.amazonaws.<region>.<service>
(the SageMaker Notebook service is an exception to this rule, the service name is in the form aws.sagemaker.<region>.notebook
).
The VPC endpoint type, Gateway
, GatewayLoadBalancer
, or Interface
. Defaults to Gateway
.