# VpcEndpointIpAddressType

IP address type for the endpoint.

- Source: [`aws-ec2/lib/vpc-endpoint.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/aws-ec2/lib/vpc-endpoint.ts#L131)
- Type last changed: v2.190.0 · 17 Apr 2025

## Example

TypeScript:

```ts
// Interface endpoint with IPv6
vpc.addInterfaceEndpoint('ExampleEndpoint', {
  service: ec2.InterfaceVpcEndpointAwsService.ECR,
  ipAddressType: ec2.VpcEndpointIpAddressType.IPV6,
  dnsRecordIpType: ec2.VpcEndpointDnsRecordIpType.IPV6,
});

// Gateway endpoint with dualstack
vpc.addGatewayEndpoint('S3DualstackEndpoint', {
  service: ec2.GatewayVpcEndpointAwsService.S3,
  ipAddressType: ec2.VpcEndpointIpAddressType.DUALSTACK,
  dnsRecordIpType: ec2.VpcEndpointDnsRecordIpType.DUALSTACK,
});
```

Python:

```python
# Interface endpoint with IPv6
vpc.add_interface_endpoint("ExampleEndpoint",
    service=ec2.InterfaceVpcEndpointAwsService.ECR,
    ip_address_type=ec2.VpcEndpointIpAddressType.IPV6,
    dns_record_ip_type=ec2.VpcEndpointDnsRecordIpType.IPV6
)

# Gateway endpoint with dualstack
vpc.add_gateway_endpoint("S3DualstackEndpoint",
    service=ec2.GatewayVpcEndpointAwsService.S3,
    ip_address_type=ec2.VpcEndpointIpAddressType.DUALSTACK,
    dns_record_ip_type=ec2.VpcEndpointDnsRecordIpType.DUALSTACK
)
```

Java:

```java
// Interface endpoint with IPv6
vpc.addInterfaceEndpoint("ExampleEndpoint", InterfaceVpcEndpointOptions.builder()
        .service(InterfaceVpcEndpointAwsService.ECR)
        .ipAddressType(VpcEndpointIpAddressType.IPV6)
        .dnsRecordIpType(VpcEndpointDnsRecordIpType.IPV6)
        .build());

// Gateway endpoint with dualstack
vpc.addGatewayEndpoint("S3DualstackEndpoint", GatewayVpcEndpointOptions.builder()
        .service(GatewayVpcEndpointAwsService.S3)
        .ipAddressType(VpcEndpointIpAddressType.DUALSTACK)
        .dnsRecordIpType(VpcEndpointDnsRecordIpType.DUALSTACK)
        .build());
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
// Interface endpoint with IPv6
vpc.AddInterfaceEndpoint("ExampleEndpoint", new InterfaceVpcEndpointOptions {
    Service = InterfaceVpcEndpointAwsService.ECR,
    IpAddressType = VpcEndpointIpAddressType.IPV6,
    DnsRecordIpType = VpcEndpointDnsRecordIpType.IPV6
});

// Gateway endpoint with dualstack
vpc.AddGatewayEndpoint("S3DualstackEndpoint", new GatewayVpcEndpointOptions {
    Service = GatewayVpcEndpointAwsService.S3,
    IpAddressType = VpcEndpointIpAddressType.DUALSTACK,
    DnsRecordIpType = VpcEndpointDnsRecordIpType.DUALSTACK
});
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// Interface endpoint with IPv6
vpc.addInterfaceEndpoint(jsii.String("ExampleEndpoint"), &InterfaceVpcEndpointOptions{
	Service: ec2.InterfaceVpcEndpointAwsService_ECR(),
	IpAddressType: ec2.VpcEndpointIpAddressType_IPV6,
	DnsRecordIpType: ec2.VpcEndpointDnsRecordIpType_IPV6,
})

// Gateway endpoint with dualstack
vpc.addGatewayEndpoint(jsii.String("S3DualstackEndpoint"), &GatewayVpcEndpointOptions{
	Service: ec2.GatewayVpcEndpointAwsService_S3(),
	IpAddressType: ec2.VpcEndpointIpAddressType_DUALSTACK,
	DnsRecordIpType: ec2.VpcEndpointDnsRecordIpType_DUALSTACK,
})
```

## Members

| Member | Description |
| --- | --- |
| `IPV4` | Assign IPv4 addresses to the endpoint network interfaces. |
| `IPV6` | Assign IPv6 addresses to the endpoint network interfaces. |
| `DUALSTACK` | Assign both IPv4 and IPv6 addresses to the endpoint network interfaces. |

## Referenced by

- [`GatewayVpcEndpointOptions`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.GatewayVpcEndpointOptions.html).ipAddressType
- [`InterfaceVpcEndpointOptions`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.InterfaceVpcEndpointOptions.html).ipAddressType
