# GatewayVpcEndpointProps

Construction properties for a GatewayVpcEndpoint.

Extends: [GatewayVpcEndpointOptions](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.GatewayVpcEndpointOptions.html)
Used as props by: [GatewayVpcEndpoint](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.GatewayVpcEndpoint.html)

- 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#L274)

## Example

TypeScript:

```ts
const stack = new Stack();
const myVpc = new VpcV2(this, 'Vpc');
const routeTable = new RouteTable(this, 'RouteTable', {
  vpc: myVpc,
});
const subnet = new SubnetV2(this, 'Subnet', {
  vpc: myVpc,
  availabilityZone: 'eu-west-2a',
  ipv4CidrBlock: new IpCidr('10.0.0.0/24'),
  subnetType: SubnetType.PRIVATE });

const dynamoEndpoint = new ec2.GatewayVpcEndpoint(this, 'DynamoEndpoint', {
  service: ec2.GatewayVpcEndpointAwsService.DYNAMODB,
  vpc: myVpc,
  subnets: [subnet],
});
new Route(this, 'DynamoDBRoute', {
  routeTable,
  destination: '0.0.0.0/0',
  target: { endpoint: dynamoEndpoint },
});
```

Python:

```python
stack = Stack()
my_vpc = VpcV2(self, "Vpc")
route_table = RouteTable(self, "RouteTable",
    vpc=my_vpc
)
subnet = SubnetV2(self, "Subnet",
    vpc=my_vpc,
    availability_zone="eu-west-2a",
    ipv4_cidr_block=IpCidr("10.0.0.0/24"),
    subnet_type=SubnetType.PRIVATE
)

dynamo_endpoint = ec2.GatewayVpcEndpoint(self, "DynamoEndpoint",
    service=ec2.GatewayVpcEndpointAwsService.DYNAMODB,
    vpc=my_vpc,
    subnets=[subnet]
)
Route(self, "DynamoDBRoute",
    route_table=route_table,
    destination="0.0.0.0/0",
    target={"endpoint": dynamo_endpoint}
)
```

Java:

```java
Stack stack = new Stack();
VpcV2 myVpc = new VpcV2(this, "Vpc");
RouteTable routeTable = RouteTable.Builder.create(this, "RouteTable")
        .vpc(myVpc)
        .build();
SubnetV2 subnet = SubnetV2.Builder.create(this, "Subnet")
        .vpc(myVpc)
        .availabilityZone("eu-west-2a")
        .ipv4CidrBlock(new IpCidr("10.0.0.0/24"))
        .subnetType(SubnetType.PRIVATE)
        .build();

GatewayVpcEndpoint dynamoEndpoint = GatewayVpcEndpoint.Builder.create(this, "DynamoEndpoint")
        .service(GatewayVpcEndpointAwsService.DYNAMODB)
        .vpc(myVpc)
        .subnets(List.of(subnet))
        .build();
Route.Builder.create(this, "DynamoDBRoute")
        .routeTable(routeTable)
        .destination("0.0.0.0/0")
        .target(Map.of("endpoint", dynamoEndpoint))
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
var stack = new Stack();
var myVpc = new VpcV2(this, "Vpc");
var routeTable = new RouteTable(this, "RouteTable", new RouteTableProps {
    Vpc = myVpc
});
var subnet = new SubnetV2(this, "Subnet", new SubnetV2Props {
    Vpc = myVpc,
    AvailabilityZone = "eu-west-2a",
    Ipv4CidrBlock = new IpCidr("10.0.0.0/24"),
    SubnetType = SubnetType.PRIVATE
});

var dynamoEndpoint = new GatewayVpcEndpoint(this, "DynamoEndpoint", new GatewayVpcEndpointProps {
    Service = GatewayVpcEndpointAwsService.DYNAMODB,
    Vpc = myVpc,
    Subnets = new [] { subnet }
});
new Route(this, "DynamoDBRoute", new RouteProps {
    RouteTable = routeTable,
    Destination = "0.0.0.0/0",
    Target = new Dictionary<string, IVpcEndpoint?> { { "endpoint", dynamoEndpoint } }
});
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
stack := awscdk.Newstack()
myVpc := awsec2alpha.NewVpcV2(this, jsii.String("Vpc"))
routeTable := awsec2alpha.NewRouteTable(this, jsii.String("RouteTable"), &RouteTableProps{
	Vpc: myVpc,
})
subnet := awsec2alpha.NewSubnetV2(this, jsii.String("Subnet"), &SubnetV2Props{
	Vpc: myVpc,
	AvailabilityZone: jsii.String("eu-west-2a"),
	Ipv4CidrBlock: awsec2alpha.NewIpCidr(jsii.String("10.0.0.0/24")),
	SubnetType: awscdk.SubnetType_PRIVATE,
})

dynamoEndpoint := ec2.NewGatewayVpcEndpoint(this, jsii.String("DynamoEndpoint"), &GatewayVpcEndpointProps{
	Service: ec2.GatewayVpcEndpointAwsService_DYNAMODB(),
	Vpc: myVpc,
	Subnets: []SubnetSelection{
		subnet,
	},
})
awsec2alpha.NewRoute(this, jsii.String("DynamoDBRoute"), &RouteProps{
	RouteTable: RouteTable,
	Destination: jsii.String("0.0.0.0/0"),
	Target: map[string]iVpcEndpoint{
		"endpoint": dynamoEndpoint,
	},
})
```

## Properties

- `dnsRecordIpType`: [VpcEndpointDnsRecordIpType](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.VpcEndpointDnsRecordIpType.html) — Type of DNS records created for the VPC endpoint.

  **Default:** not specified

- `ipAddressType`: [VpcEndpointIpAddressType](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.VpcEndpointIpAddressType.html) — The IP address type for the endpoint.

  **Default:** not specified

- `service`: [IGatewayVpcEndpointService](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.IGatewayVpcEndpointService.html) (required) — The service to use for this gateway VPC endpoint.

- `subnets`: [SubnetSelection](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.SubnetSelection.html)[] — Where to add endpoint routing.

  **Default:** All subnets in the VPC

  By default, this endpoint will be routable from all subnets in the VPC.
  Specify a list of subnet selection objects here to be more specific.

  ```ts
  declare const vpc: ec2.Vpc;

  vpc.addGatewayEndpoint('DynamoDbEndpoint', {
    service: ec2.GatewayVpcEndpointAwsService.DYNAMODB,
    // Add only to ISOLATED subnets
    subnets: [
      { subnetType: ec2.SubnetType.PRIVATE_ISOLATED }
    ]
  });
  ```

- `vpc`: [IVpc](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.IVpc.html) (required) — The VPC network in which the gateway endpoint will be used.
