# OriginIpAddressType

The IP address type for the origin.

Determines whether CloudFront uses IPv4, IPv6, or both when connecting to the origin.

- Source: [`aws-cloudfront/lib/origin.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/aws-cloudfront/lib/origin.ts#L28)
- Type last changed: v2.218.0 · 29 Sep 2025

## Example

TypeScript:

```ts
const origin = new origins.HttpOrigin('www.example.com', {
  ipAddressType: cloudfront.OriginIpAddressType.IPV6, // IPv4, IPv6, or DUALSTACK
});

new cloudfront.Distribution(this, 'Distribution', {
  defaultBehavior: { origin },
});
```

Python:

```python
origin = origins.HttpOrigin("www.example.com",
    ip_address_type=cloudfront.OriginIpAddressType.IPV6
)

cloudfront.Distribution(self, "Distribution",
    default_behavior=cloudfront.BehaviorOptions(origin=origin)
)
```

Java:

```java
HttpOrigin origin = HttpOrigin.Builder.create("www.example.com")
        .ipAddressType(OriginIpAddressType.IPV6)
        .build();

Distribution.Builder.create(this, "Distribution")
        .defaultBehavior(BehaviorOptions.builder().origin(origin).build())
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
var origin = new HttpOrigin("www.example.com", new HttpOriginProps {
    IpAddressType = OriginIpAddressType.IPV6
});

new Distribution(this, "Distribution", new DistributionProps {
    DefaultBehavior = new BehaviorOptions { Origin = origin }
});
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
origin := origins.NewHttpOrigin(jsii.String("www.example.com"), &HttpOriginProps{
	IpAddressType: cloudfront.OriginIpAddressType_IPV6,
})

cloudfront.NewDistribution(this, jsii.String("Distribution"), &DistributionProps{
	DefaultBehavior: &BehaviorOptions{
		Origin: *Origin,
	},
})
```

## Members

| Member | Description |
| --- | --- |
| `IPV4` | Use only IPv4 addresses. |
| `IPV6` | Use only IPv6 addresses. |
| `DUALSTACK` | Use both IPv4 and IPv6 addresses. |

## Referenced by

- [`FunctionUrlOriginProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cloudfront_origins.FunctionUrlOriginProps.html).ipAddressType
- [`HttpOriginProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cloudfront_origins.HttpOriginProps.html).ipAddressType
