Skip to content
v2.277.0

CfnDistributionProps Struct ​

Properties for defining a CfnDistribution.

Example ​

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
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
// 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();
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"
    } }
};
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 ​

bundleIdstringbundle_idstrbundleIdStringBundleIdstringBundleId*string required #
The ID of the bundle applied to the distribution.
cacheBehaviorsoptionalIResolvable | IResolvable | CfnDistribution.CacheBehaviorPerPathProperty[]cache_behaviorsoptionaltyping.Union[IResolvable, typing.List[typing.Union[IResolvable, CacheBehaviorPerPathProperty]]]cacheBehaviorsoptionalIResolvableCacheBehaviorsoptionalIResolvableCacheBehaviorsoptionalinterface{} #
An array of objects that describe the per-path cache behavior of the distribution.
cacheBehaviorSettingsoptionalIResolvable | CfnDistribution.CacheSettingsPropertycache_behavior_settingsoptionaltyping.Union[IResolvable, CacheSettingsProperty]cacheBehaviorSettingsoptionalIResolvableCacheBehaviorSettingsoptionalIResolvableCacheBehaviorSettingsoptionalinterface{} #
An object that describes the cache behavior settings of the distribution.
certificateNameoptionalstringcertificate_nameoptionalstrcertificateNameoptionalStringCertificateNameoptionalstringCertificateNameoptional*string #
The name of the SSL/TLS certificate attached to the distribution.
defaultCacheBehaviorIResolvable | CfnDistribution.CacheBehaviorPropertydefault_cache_behaviortyping.Union[IResolvable, CacheBehaviorProperty]defaultCacheBehaviorIResolvableDefaultCacheBehaviorIResolvableDefaultCacheBehaviorinterface{} required #
An object that describes the default cache behavior of the distribution.
distributionNamestringdistribution_namestrdistributionNameStringDistributionNamestringDistributionName*string required #
The name of the distribution.
ipAddressTypeoptionalstringip_address_typeoptionalstripAddressTypeoptionalStringIpAddressTypeoptionalstringIpAddressTypeoptional*string #
The IP address type of the distribution.

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

isEnabledoptionalboolean | IResolvableis_enabledoptionaltyping.Union[bool, IResolvable]isEnabledoptionalBooleanIsEnabledoptionalboolIsEnabledoptionalinterface{} #
A Boolean value indicating whether the distribution is enabled.
originIResolvable | CfnDistribution.InputOriginPropertyorigintyping.Union[IResolvable, InputOriginProperty]originIResolvableOriginIResolvableOrigininterface{} 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.

tagsoptionalCfnTag[]tagsoptionaltyping.List[CfnTag]tagsoptionalList<CfnTag>TagsoptionalCfnTag[]Tagsoptional*[]CfnTag #
An array of key-value pairs to apply to this resource.

For more information, see Tag in the AWS CloudFormation User Guide .

The Value of Tags is optional for Lightsail resources.