Skip to content

Updates an existing Amazon Lightsail content delivery network (CDN) distribution

Description

Updates an existing Amazon Lightsail content delivery network (CDN) distribution.

Use this action to update the configuration of your existing distribution.

Usage

lightsail_update_distribution(distributionName, origin,
  defaultCacheBehavior, cacheBehaviorSettings, cacheBehaviors, isEnabled,
  viewerMinimumTlsProtocolVersion, certificateName, useDefaultCertificate,
  enablePrivateOriginAccess, defaultRootObject, customErrorResponses)

Arguments

  • distributionName

    [required] The name of the distribution to update.

    Use the get_distributions action to get a list of distribution names that you can specify.

  • origin

    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

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

  • cacheBehaviorSettings

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

    The cacheBehaviorSettings specified in your UpdateDistributionRequest will replace your distribution's existing settings.

  • cacheBehaviors

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

  • isEnabled

    Indicates whether to enable the distribution.

  • viewerMinimumTlsProtocolVersion

    Use this parameter to update the minimum TLS protocol version for the SSL/TLS certificate that's attached to the distribution.

  • certificateName

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

    Only certificates with a status of ISSUED can be attached to a distribution.

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

  • useDefaultCertificate

    Indicates whether the default SSL/TLS certificate is attached to the distribution. The default value is true. When true, the distribution uses the default domain name such as d111111abcdef8.cloudfront.net.

    Set this value to false to attach a new certificate to the distribution.

  • enablePrivateOriginAccess

    Specifies whether to enable private origin access for the distribution. With private origin access, the distribution can serve objects that aren't publicly accessible from a Lightsail bucket.

    Lightsail grants the distribution permission to read the bucket's objects. Enabling private origin access doesn't change the bucket's access settings, and you can still retrieve publicly accessible objects directly from the bucket's endpoint.

    When you include this parameter, you must also include the origin parameter with the resource name, even if the origin is not changing.

    You can enable private origin access only when the distribution's origin is a Lightsail bucket. If the origin is another resource type, the request fails.

  • defaultRootObject

    The object (for example, index.html) that the distribution returns when a viewer requests the root URL of the distribution (/) instead of a specific object. The object that you specify must be available from the origin.

  • customErrorResponses

    An array of objects that describe the custom error responses for the distribution. With a custom error response, you can specify the page to return when the origin responds with a given HTTP error code. You can also specify the HTTP status code to send to the viewer.

Value

A list with the following syntax:

list(
  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"|"eu-north-1"|"eu-south-2"|"ca-central-1"|"ap-east-1"|"ap-south-1"|"ap-southeast-1"|"ap-southeast-2"|"ap-northeast-1"|"ap-northeast-2"|"ap-southeast-3"|"ap-southeast-5"|"sa-east-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"|"GetProfile",
    status = "NotStarted"|"Started"|"Failed"|"Completed"|"Succeeded",
    statusChangedAt = as.POSIXct(
      "2015-01-01"
    ),
    errorCode = "string",
    errorDetails = "string"
  )
)

Request syntax

svc$update_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"|"eu-north-1"|"eu-south-2"|"ca-central-1"|"ap-east-1"|"ap-south-1"|"ap-southeast-1"|"ap-southeast-2"|"ap-northeast-1"|"ap-northeast-2"|"ap-southeast-3"|"ap-southeast-5"|"sa-east-1",
    protocolPolicy = "http-only"|"https-only",
    responseTimeout = 123,
    ipAddressType = "ipv4"|"ipv6"|"dualstack"
  ),
  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"
    )
  ),
  isEnabled = TRUE|FALSE,
  viewerMinimumTlsProtocolVersion = "TLSv1.1_2016"|"TLSv1.2_2018"|"TLSv1.2_2019"|"TLSv1.2_2021",
  certificateName = "string",
  useDefaultCertificate = TRUE|FALSE,
  enablePrivateOriginAccess = TRUE|FALSE,
  defaultRootObject = "string",
  customErrorResponses = list(
    list(
      errorCode = 123,
      responseCode = "string",
      responsePagePath = "string",
      errorCachingMinTTL = 123
    )
  )
)