Skip to content

Create Distribution

lightsail_create_distribution R Documentation

Creates an Amazon Lightsail content delivery network (CDN) distribution

Description

Creates an Amazon Lightsail content delivery network (CDN) distribution.

A distribution is a globally distributed network of caching servers that improve the performance of your website or web application hosted on a Lightsail instance. For more information, see Content delivery networks in Amazon Lightsail.

Usage

lightsail_create_distribution(distributionName, origin,
  defaultCacheBehavior, cacheBehaviorSettings, cacheBehaviors, bundleId,
  ipAddressType, tags, certificateName, viewerMinimumTlsProtocolVersion)

Arguments

distributionName

[required] The name for the distribution.

origin

[required] An object that describes the origin resource for the distribution, such as a Lightsail instance, bucket, or load balancer.

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

defaultCacheBehavior

[required] An object that describes the default cache behavior for the distribution.

cacheBehaviorSettings

An object that describes the cache behavior settings for the distribution.

cacheBehaviors

An array of objects that describe the per-path cache behavior for the distribution.

bundleId

[required] The bundle ID to use for the distribution.

A distribution bundle describes the specifications of your distribution, such as the monthly cost and monthly network transfer quota.

Use the get_distribution_bundles action to get a list of distribution bundle IDs that you can specify.

ipAddressType

The IP address type for the distribution.

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

The default value is dualstack.

tags

The tag keys and optional values to add to the distribution during create.

Use the tag_resource action to tag a resource after it's created.

certificateName

The name of the SSL/TLS certificate that you want to attach to the distribution.

Use the get_certificates action to get a list of certificate names that you can specify.

viewerMinimumTlsProtocolVersion

The minimum TLS protocol version for the SSL/TLS certificate.

Value

A list with the following syntax:

list(
  distribution = list(
    name = "string",
    arn = "string",
    supportCode = "string",
    createdAt = as.POSIXct(
      "2015-01-01"
    ),
    location = list(
      availabilityZone = "string",
      regionName = "us-east-1"|"us-east-2"|"us-west-1"|"us-west-2"|"eu-west-1"|"eu-west-2"|"eu-west-3"|"eu-central-1"|"ca-central-1"|"ap-south-1"|"ap-southeast-1"|"ap-southeast-2"|"ap-northeast-1"|"ap-northeast-2"|"eu-north-1"
    ),
    resourceType = "ContainerService"|"Instance"|"StaticIp"|"KeyPair"|"InstanceSnapshot"|"Domain"|"PeeredVpc"|"LoadBalancer"|"LoadBalancerTlsCertificate"|"Disk"|"DiskSnapshot"|"RelationalDatabase"|"RelationalDatabaseSnapshot"|"ExportSnapshotRecord"|"CloudFormationStackRecord"|"Alarm"|"ContactMethod"|"Distribution"|"Certificate"|"Bucket",
    alternativeDomainNames = list(
      "string"
    ),
    status = "string",
    isEnabled = TRUE|FALSE,
    domainName = "string",
    bundleId = "string",
    certificateName = "string",
    origin = list(
      name = "string",
      resourceType = "ContainerService"|"Instance"|"StaticIp"|"KeyPair"|"InstanceSnapshot"|"Domain"|"PeeredVpc"|"LoadBalancer"|"LoadBalancerTlsCertificate"|"Disk"|"DiskSnapshot"|"RelationalDatabase"|"RelationalDatabaseSnapshot"|"ExportSnapshotRecord"|"CloudFormationStackRecord"|"Alarm"|"ContactMethod"|"Distribution"|"Certificate"|"Bucket",
      regionName = "us-east-1"|"us-east-2"|"us-west-1"|"us-west-2"|"eu-west-1"|"eu-west-2"|"eu-west-3"|"eu-central-1"|"ca-central-1"|"ap-south-1"|"ap-southeast-1"|"ap-southeast-2"|"ap-northeast-1"|"ap-northeast-2"|"eu-north-1",
      protocolPolicy = "http-only"|"https-only",
      responseTimeout = 123
    ),
    originPublicDNS = "string",
    defaultCacheBehavior = list(
      behavior = "dont-cache"|"cache"
    ),
    cacheBehaviorSettings = list(
      defaultTTL = 123,
      minimumTTL = 123,
      maximumTTL = 123,
      allowedHTTPMethods = "string",
      cachedHTTPMethods = "string",
      forwardedCookies = list(
        option = "none"|"allow-list"|"all",
        cookiesAllowList = list(
          "string"
        )
      ),
      forwardedHeaders = list(
        option = "none"|"allow-list"|"all",
        headersAllowList = list(
          "Accept"|"Accept-Charset"|"Accept-Datetime"|"Accept-Encoding"|"Accept-Language"|"Authorization"|"CloudFront-Forwarded-Proto"|"CloudFront-Is-Desktop-Viewer"|"CloudFront-Is-Mobile-Viewer"|"CloudFront-Is-SmartTV-Viewer"|"CloudFront-Is-Tablet-Viewer"|"CloudFront-Viewer-Country"|"Host"|"Origin"|"Referer"
        )
      ),
      forwardedQueryStrings = list(
        option = TRUE|FALSE,
        queryStringsAllowList = list(
          "string"
        )
      )
    ),
    cacheBehaviors = list(
      list(
        path = "string",
        behavior = "dont-cache"|"cache"
      )
    ),
    ableToUpdateBundle = TRUE|FALSE,
    ipAddressType = "dualstack"|"ipv4"|"ipv6",
    tags = list(
      list(
        key = "string",
        value = "string"
      )
    ),
    viewerMinimumTlsProtocolVersion = "string"
  ),
  operation = list(
    id = "string",
    resourceName = "string",
    resourceType = "ContainerService"|"Instance"|"StaticIp"|"KeyPair"|"InstanceSnapshot"|"Domain"|"PeeredVpc"|"LoadBalancer"|"LoadBalancerTlsCertificate"|"Disk"|"DiskSnapshot"|"RelationalDatabase"|"RelationalDatabaseSnapshot"|"ExportSnapshotRecord"|"CloudFormationStackRecord"|"Alarm"|"ContactMethod"|"Distribution"|"Certificate"|"Bucket",
    createdAt = as.POSIXct(
      "2015-01-01"
    ),
    location = list(
      availabilityZone = "string",
      regionName = "us-east-1"|"us-east-2"|"us-west-1"|"us-west-2"|"eu-west-1"|"eu-west-2"|"eu-west-3"|"eu-central-1"|"ca-central-1"|"ap-south-1"|"ap-southeast-1"|"ap-southeast-2"|"ap-northeast-1"|"ap-northeast-2"|"eu-north-1"
    ),
    isTerminal = TRUE|FALSE,
    operationDetails = "string",
    operationType = "DeleteKnownHostKeys"|"DeleteInstance"|"CreateInstance"|"StopInstance"|"StartInstance"|"RebootInstance"|"OpenInstancePublicPorts"|"PutInstancePublicPorts"|"CloseInstancePublicPorts"|"AllocateStaticIp"|"ReleaseStaticIp"|"AttachStaticIp"|"DetachStaticIp"|"UpdateDomainEntry"|"DeleteDomainEntry"|"CreateDomain"|"DeleteDomain"|"CreateInstanceSnapshot"|"DeleteInstanceSnapshot"|"CreateInstancesFromSnapshot"|"CreateLoadBalancer"|"DeleteLoadBalancer"|"AttachInstancesToLoadBalancer"|"DetachInstancesFromLoadBalancer"|"UpdateLoadBalancerAttribute"|"CreateLoadBalancerTlsCertificate"|"DeleteLoadBalancerTlsCertificate"|"AttachLoadBalancerTlsCertificate"|"CreateDisk"|"DeleteDisk"|"AttachDisk"|"DetachDisk"|"CreateDiskSnapshot"|"DeleteDiskSnapshot"|"CreateDiskFromSnapshot"|"CreateRelationalDatabase"|"UpdateRelationalDatabase"|"DeleteRelationalDatabase"|"CreateRelationalDatabaseFromSnapshot"|"CreateRelationalDatabaseSnapshot"|"DeleteRelationalDatabaseSnapshot"|"UpdateRelationalDatabaseParameters"|"StartRelationalDatabase"|"RebootRelationalDatabase"|"StopRelationalDatabase"|"EnableAddOn"|"DisableAddOn"|"PutAlarm"|"GetAlarms"|"DeleteAlarm"|"TestAlarm"|"CreateContactMethod"|"GetContactMethods"|"SendContactMethodVerification"|"DeleteContactMethod"|"CreateDistribution"|"UpdateDistribution"|"DeleteDistribution"|"ResetDistributionCache"|"AttachCertificateToDistribution"|"DetachCertificateFromDistribution"|"UpdateDistributionBundle"|"SetIpAddressType"|"CreateCertificate"|"DeleteCertificate"|"CreateContainerService"|"UpdateContainerService"|"DeleteContainerService"|"CreateContainerServiceDeployment"|"CreateContainerServiceRegistryLogin"|"RegisterContainerImage"|"DeleteContainerImage"|"CreateBucket"|"DeleteBucket"|"CreateBucketAccessKey"|"DeleteBucketAccessKey"|"UpdateBucketBundle"|"UpdateBucket"|"SetResourceAccessForBucket"|"UpdateInstanceMetadataOptions"|"StartGUISession"|"StopGUISession"|"SetupInstanceHttps",
    status = "NotStarted"|"Started"|"Failed"|"Completed"|"Succeeded",
    statusChangedAt = as.POSIXct(
      "2015-01-01"
    ),
    errorCode = "string",
    errorDetails = "string"
  )
)

Request syntax

svc$create_distribution(
  distributionName = "string",
  origin = list(
    name = "string",
    regionName = "us-east-1"|"us-east-2"|"us-west-1"|"us-west-2"|"eu-west-1"|"eu-west-2"|"eu-west-3"|"eu-central-1"|"ca-central-1"|"ap-south-1"|"ap-southeast-1"|"ap-southeast-2"|"ap-northeast-1"|"ap-northeast-2"|"eu-north-1",
    protocolPolicy = "http-only"|"https-only",
    responseTimeout = 123
  ),
  defaultCacheBehavior = list(
    behavior = "dont-cache"|"cache"
  ),
  cacheBehaviorSettings = list(
    defaultTTL = 123,
    minimumTTL = 123,
    maximumTTL = 123,
    allowedHTTPMethods = "string",
    cachedHTTPMethods = "string",
    forwardedCookies = list(
      option = "none"|"allow-list"|"all",
      cookiesAllowList = list(
        "string"
      )
    ),
    forwardedHeaders = list(
      option = "none"|"allow-list"|"all",
      headersAllowList = list(
        "Accept"|"Accept-Charset"|"Accept-Datetime"|"Accept-Encoding"|"Accept-Language"|"Authorization"|"CloudFront-Forwarded-Proto"|"CloudFront-Is-Desktop-Viewer"|"CloudFront-Is-Mobile-Viewer"|"CloudFront-Is-SmartTV-Viewer"|"CloudFront-Is-Tablet-Viewer"|"CloudFront-Viewer-Country"|"Host"|"Origin"|"Referer"
      )
    ),
    forwardedQueryStrings = list(
      option = TRUE|FALSE,
      queryStringsAllowList = list(
        "string"
      )
    )
  ),
  cacheBehaviors = list(
    list(
      path = "string",
      behavior = "dont-cache"|"cache"
    )
  ),
  bundleId = "string",
  ipAddressType = "dualstack"|"ipv4"|"ipv6",
  tags = list(
    list(
      key = "string",
      value = "string"
    )
  ),
  certificateName = "string",
  viewerMinimumTlsProtocolVersion = "TLSv1.1_2016"|"TLSv1.2_2018"|"TLSv1.2_2019"|"TLSv1.2_2021"
)