# CfnDistributionProps

Properties for defining a `CfnDistribution`.

Used as props by: [CfnDistribution](/cdk/api/v2/docs/aws-cdk-lib.aws_lightsail.CfnDistribution.html)

- Source: Generated at build time
- Type last changed: v2.10.0 · 29 Jan 2022

## Example

TypeScript:

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_lightsail as lightsail } from 'aws-cdk-lib';
const cfnDistributionProps: lightsail.CfnDistributionProps = {
  bundleId: 'bundleId',
  defaultCacheBehavior: {
    behavior: 'behavior',
  },
  distributionName: 'distributionName',
  origin: {
    name: 'name',
    protocolPolicy: 'protocolPolicy',
    regionName: 'regionName',
  },

  // the properties below are optional
  cacheBehaviors: [{
    behavior: 'behavior',
    path: 'path',
  }],
  cacheBehaviorSettings: {
    allowedHttpMethods: 'allowedHttpMethods',
    cachedHttpMethods: 'cachedHttpMethods',
    defaultTtl: 123,
    forwardedCookies: {
      cookiesAllowList: ['cookiesAllowList'],
      option: 'option',
    },
    forwardedHeaders: {
      headersAllowList: ['headersAllowList'],
      option: 'option',
    },
    forwardedQueryStrings: {
      option: false,
      queryStringsAllowList: ['queryStringsAllowList'],
    },
    maximumTtl: 123,
    minimumTtl: 123,
  },
  certificateName: 'certificateName',
  ipAddressType: 'ipAddressType',
  isEnabled: false,
  tags: [{
    key: 'key',
    value: 'value',
  }],
};
```

Python:

```python
from aws_cdk import CfnTag
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_lightsail as lightsail

cfn_distribution_props = lightsail.CfnDistributionProps(
    bundle_id="bundleId",
    default_cache_behavior=lightsail.CfnDistribution.CacheBehaviorProperty(
        behavior="behavior"
    ),
    distribution_name="distributionName",
    origin=lightsail.CfnDistribution.InputOriginProperty(
        name="name",
        protocol_policy="protocolPolicy",
        region_name="regionName"
    ),

    # the properties below are optional
    cache_behaviors=[lightsail.CfnDistribution.CacheBehaviorPerPathProperty(
        behavior="behavior",
        path="path"
    )],
    cache_behavior_settings=lightsail.CfnDistribution.CacheSettingsProperty(
        allowed_http_methods="allowedHttpMethods",
        cached_http_methods="cachedHttpMethods",
        default_ttl=123,
        forwarded_cookies=lightsail.CfnDistribution.CookieObjectProperty(
            cookies_allow_list=["cookiesAllowList"],
            option="option"
        ),
        forwarded_headers=lightsail.CfnDistribution.HeaderObjectProperty(
            headers_allow_list=["headersAllowList"],
            option="option"
        ),
        forwarded_query_strings=lightsail.CfnDistribution.QueryStringObjectProperty(
            option=False,
            query_strings_allow_list=["queryStringsAllowList"]
        ),
        maximum_ttl=123,
        minimum_ttl=123
    ),
    certificate_name="certificateName",
    ip_address_type="ipAddressType",
    is_enabled=False,
    tags=[CfnTag(
        key="key",
        value="value"
    )]
)
```

Java:

```java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.lightsail.*;

CfnDistributionProps cfnDistributionProps = CfnDistributionProps.builder()
        .bundleId("bundleId")
        .defaultCacheBehavior(CacheBehaviorProperty.builder()
                .behavior("behavior")
                .build())
        .distributionName("distributionName")
        .origin(InputOriginProperty.builder()
                .name("name")
                .protocolPolicy("protocolPolicy")
                .regionName("regionName")
                .build())

        // the properties below are optional
        .cacheBehaviors(List.of(CacheBehaviorPerPathProperty.builder()
                .behavior("behavior")
                .path("path")
                .build()))
        .cacheBehaviorSettings(CacheSettingsProperty.builder()
                .allowedHttpMethods("allowedHttpMethods")
                .cachedHttpMethods("cachedHttpMethods")
                .defaultTtl(123)
                .forwardedCookies(CookieObjectProperty.builder()
                        .cookiesAllowList(List.of("cookiesAllowList"))
                        .option("option")
                        .build())
                .forwardedHeaders(HeaderObjectProperty.builder()
                        .headersAllowList(List.of("headersAllowList"))
                        .option("option")
                        .build())
                .forwardedQueryStrings(QueryStringObjectProperty.builder()
                        .option(false)
                        .queryStringsAllowList(List.of("queryStringsAllowList"))
                        .build())
                .maximumTtl(123)
                .minimumTtl(123)
                .build())
        .certificateName("certificateName")
        .ipAddressType("ipAddressType")
        .isEnabled(false)
        .tags(List.of(CfnTag.builder()
                .key("key")
                .value("value")
                .build()))
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.Lightsail;

var cfnDistributionProps = new CfnDistributionProps {
    BundleId = "bundleId",
    DefaultCacheBehavior = new CacheBehaviorProperty {
        Behavior = "behavior"
    },
    DistributionName = "distributionName",
    Origin = new InputOriginProperty {
        Name = "name",
        ProtocolPolicy = "protocolPolicy",
        RegionName = "regionName"
    },

    // the properties below are optional
    CacheBehaviors = new [] { new CacheBehaviorPerPathProperty {
        Behavior = "behavior",
        Path = "path"
    } },
    CacheBehaviorSettings = new CacheSettingsProperty {
        AllowedHttpMethods = "allowedHttpMethods",
        CachedHttpMethods = "cachedHttpMethods",
        DefaultTtl = 123,
        ForwardedCookies = new CookieObjectProperty {
            CookiesAllowList = new [] { "cookiesAllowList" },
            Option = "option"
        },
        ForwardedHeaders = new HeaderObjectProperty {
            HeadersAllowList = new [] { "headersAllowList" },
            Option = "option"
        },
        ForwardedQueryStrings = new QueryStringObjectProperty {
            Option = false,
            QueryStringsAllowList = new [] { "queryStringsAllowList" }
        },
        MaximumTtl = 123,
        MinimumTtl = 123
    },
    CertificateName = "certificateName",
    IpAddressType = "ipAddressType",
    IsEnabled = false,
    Tags = new [] { new CfnTag {
        Key = "key",
        Value = "value"
    } }
};
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

cfnDistributionProps := &CfnDistributionProps{
	BundleId: jsii.String("bundleId"),
	DefaultCacheBehavior: &CacheBehaviorProperty{
		Behavior: jsii.String("behavior"),
	},
	DistributionName: jsii.String("distributionName"),
	Origin: &InputOriginProperty{
		Name: jsii.String("name"),
		ProtocolPolicy: jsii.String("protocolPolicy"),
		RegionName: jsii.String("regionName"),
	},

	// the properties below are optional
	CacheBehaviors: []interface{}{
		&CacheBehaviorPerPathProperty{
			Behavior: jsii.String("behavior"),
			Path: jsii.String("path"),
		},
	},
	CacheBehaviorSettings: &CacheSettingsProperty{
		AllowedHttpMethods: jsii.String("allowedHttpMethods"),
		CachedHttpMethods: jsii.String("cachedHttpMethods"),
		DefaultTtl: jsii.Number(123),
		ForwardedCookies: &CookieObjectProperty{
			CookiesAllowList: []*string{
				jsii.String("cookiesAllowList"),
			},
			Option: jsii.String("option"),
		},
		ForwardedHeaders: &HeaderObjectProperty{
			HeadersAllowList: []*string{
				jsii.String("headersAllowList"),
			},
			Option: jsii.String("option"),
		},
		ForwardedQueryStrings: &QueryStringObjectProperty{
			Option: jsii.Boolean(false),
			QueryStringsAllowList: []*string{
				jsii.String("queryStringsAllowList"),
			},
		},
		MaximumTtl: jsii.Number(123),
		MinimumTtl: jsii.Number(123),
	},
	CertificateName: jsii.String("certificateName"),
	IpAddressType: jsii.String("ipAddressType"),
	IsEnabled: jsii.Boolean(false),
	Tags: []CfnTag{
		&CfnTag{
			Key: jsii.String("key"),
			Value: jsii.String("value"),
		},
	},
}
```

## Properties

- `bundleId`: string (required) — The ID of the bundle applied to the distribution.

- `cacheBehaviors`: [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnDistribution.CacheBehaviorPerPathProperty](/cdk/api/v2/docs/aws-cdk-lib.aws_lightsail.CfnDistribution.CacheBehaviorPerPathProperty.html)[] — An array of objects that describe the per-path cache behavior of the distribution.

- `cacheBehaviorSettings`: [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnDistribution.CacheSettingsProperty](/cdk/api/v2/docs/aws-cdk-lib.aws_lightsail.CfnDistribution.CacheSettingsProperty.html) — An object that describes the cache behavior settings of the distribution.

- `certificateName`: string — The name of the SSL/TLS certificate attached to the distribution.

- `defaultCacheBehavior`: [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnDistribution.CacheBehaviorProperty](/cdk/api/v2/docs/aws-cdk-lib.aws_lightsail.CfnDistribution.CacheBehaviorProperty.html) (required) — An object that describes the default cache behavior of the distribution.

- `distributionName`: string (required) — The name of the distribution.

- `ipAddressType`: string — The IP address type of the distribution.

  The possible values are `ipv4` for IPv4 only, and `dualstack` for IPv4 and IPv6.

- `isEnabled`: boolean | [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) — A Boolean value indicating whether the distribution is enabled.

- `origin`: [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnDistribution.InputOriginProperty](/cdk/api/v2/docs/aws-cdk-lib.aws_lightsail.CfnDistribution.InputOriginProperty.html) (required) — An object that describes the origin resource of the distribution, such as a Lightsail instance, bucket, or load balancer.

  The distribution pulls, caches, and serves content from the origin.

- `tags`: [CfnTag](/cdk/api/v2/docs/aws-cdk-lib.CfnTag.html)[] — An array of key-value pairs to apply to this resource.

  For more information, see [Tag](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-resource-tags.html) in the *AWS CloudFormation User Guide* .

  > The `Value` of `Tags` is optional for Lightsail resources.
