Lightsail / Client / update_subdomain_association

update_subdomain_association

Lightsail.Client.update_subdomain_association(**kwargs)

Associates a Lightsail subdomain with a resource, disassociates it from a resource, or moves it from one resource to another resource.

Currently, you can associate a subdomain only with a Lightsail content delivery network (CDN) distribution. A resource can be associated with only one subdomain at a time.

When you associate a subdomain with a distribution, Lightsail attaches the subdomain’s certificate to the distribution. You can’t associate a subdomain with a distribution that uses a custom domain, which is a distribution that has a Lightsail certificate attached.

You can transfer each subdomain to another resource only once in a 24-hour period.

The update is asynchronous. The response returns the subdomain in the ATTACHING, DETACHING, or TRANSFERRING state, and an operation. To check when the update is complete, use the GetSubdomains action.

See also: AWS API Documentation

Request Syntax

response = client.update_subdomain_association(
    subdomainName='string',
    action='ASSOCIATE'|'DISASSOCIATE'|'TRANSFER',
    targetResourceArn='string'
)
Parameters:
  • subdomainName (string) –

    [REQUIRED]

    The subdomain to update (for example, mysite or blog.mysite), not its web address.

  • action (string) –

    [REQUIRED]

    The association change to make.

    The following actions are possible:

    • ASSOCIATE – Associates the subdomain with the resource that you specify in the targetResourceArn parameter. The subdomain must be in the UNATTACHED state.

    • DISASSOCIATE – Disassociates the subdomain from its current resource. The subdomain must be in the ATTACHED state.

    • TRANSFER – Moves the subdomain from its current resource to the resource that you specify in the targetResourceArn parameter. The subdomain must be in the ATTACHED state. You can transfer each subdomain only once in a 24-hour period.

  • targetResourceArn (string) –

    The Amazon Resource Name (ARN) of the resource to associate the subdomain with. The resource must be in your account.

    This parameter is required when the action is ASSOCIATE or TRANSFER. It’s ignored when the action is DISASSOCIATE.

Return type:

dict

Returns:

Response Syntax

{
    'subdomain': {
        'subdomainName': 'string',
        'arn': 'string',
        'fqdn': 'string',
        'depth': 123,
        'state': 'CREATING'|'CREATE_FAILED'|'UNATTACHED'|'ATTACHING'|'ATTACHED'|'DETACHING'|'TRANSFERRING'|'IMPLICIT',
        'attachedResource': {
            'arn': 'string',
            'name': 'string',
            'attachedAt': datetime(2015, 1, 1)
        },
        'attachingResource': {
            'arn': 'string',
            'name': 'string',
            'attachedAt': datetime(2015, 1, 1)
        },
        'location': {
            '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'
        },
        'createdAt': datetime(2015, 1, 1),
        'parentFqdn': 'string',
        'children': [
            {'... recursive ...'},
        ],
        'tags': [
            {
                'key': 'string',
                'value': 'string'
            },
        ]
    },
    'operation': {
        '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'|'Subdomain',
        'createdAt': datetime(2015, 1, 1),
        'location': {
            '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'|'CreateSubdomain'|'UpdateSubdomainAssociation'|'DeleteSubdomain',
        'status': 'NotStarted'|'Started'|'Failed'|'Completed'|'Succeeded',
        'statusChangedAt': datetime(2015, 1, 1),
        'errorCode': 'string',
        'errorDetails': 'string'
    }
}

Response Structure

  • (dict) –

    • subdomain (dict) –

      An object that describes the subdomain that was updated.

      • subdomainName (string) –

        The subdomain (for example, mysite or blog.mysite). To get the web address, use the fqdn parameter.

      • arn (string) –

        The Amazon Resource Name (ARN) of the subdomain.

        If you create a subdomain with a depth of 2, such as blog.mysite, without first creating the subdomain with a depth of 1 ( mysite), Lightsail holds mysite for your account in the IMPLICIT state. It doesn’t have an ARN until you create a subdomain with that name.

      • fqdn (string) –

        The web address of the subdomain, which is the subdomain followed by amazonlightsail.com (for example, blog.mysite.amazonlightsail.com).

      • depth (integer) –

        The number of labels in the subdomain. A top-level subdomain, such as mysite, has a depth of 1. A nested subdomain, such as blog.mysite, has a depth of 2.

      • state (string) –

        The state of the subdomain.

        The following states are possible:

        • CREATING – The subdomain is being created.

        • CREATE_FAILED – The subdomain couldn’t be created. Delete the subdomain, and then create it again if the name is still available.

        • UNATTACHED – The subdomain is ready, and isn’t associated with a resource.

        • ATTACHING – The subdomain is being associated with a resource.

        • ATTACHED – The subdomain is associated with a resource, and routes traffic to it.

        • DETACHING – The subdomain is being disassociated from a resource.

        • TRANSFERRING – The subdomain is being moved from one resource to another resource.

        • IMPLICIT – The subdomain is the parent of one or more nested subdomains that you created, but you didn’t create the parent subdomain itself. You can’t associate or delete a subdomain in this state. To use it, create it with the CreateSubdomain action.

      • attachedResource (dict) –

        An object that describes the resource that the subdomain is associated with.

        When the subdomain is in the TRANSFERRING state, this is the resource that the subdomain is being moved from.

        • arn (string) –

          The Amazon Resource Name (ARN) of the resource.

        • name (string) –

          The name of the resource.

        • attachedAt (datetime) –

          The timestamp when the subdomain was associated with the resource.

      • attachingResource (dict) –

        An object that describes the resource that the subdomain is being associated with.

        This parameter is returned only when the subdomain is in the ATTACHING or TRANSFERRING state.

        • arn (string) –

          The Amazon Resource Name (ARN) of the resource.

        • name (string) –

          The name of the resource.

        • attachedAt (datetime) –

          The timestamp when the subdomain was associated with the resource.

      • location (dict) –

        An object that describes the location of the subdomain, such as the AWS Region.

        • availabilityZone (string) –

          The Availability Zone. Follows the format us-east-2a (case-sensitive).

        • regionName (string) –

          The Amazon Web Services Region name.

      • createdAt (datetime) –

        The timestamp when the subdomain was created.

      • parentFqdn (string) –

        The web address of the parent subdomain (for example, mysite.amazonlightsail.com for blog.mysite).

        This parameter isn’t returned for a subdomain with a depth of 1.

      • children (list) –

        An array of objects that describe the nested subdomains of the subdomain.

        This parameter is returned only by the GetSubdomains action when you don’t specify a subdomain.

        • (dict) –

          Describes a Lightsail subdomain. A subdomain is the name that you choose, such as mysite or blog.mysite. Its web address is the subdomain followed by amazonlightsail.com, such as blog.mysite.amazonlightsail.com. You can associate a subdomain with a Lightsail resource to make the resource reachable at the web address.

      • tags (list) –

        The tag keys and optional values for the subdomain. For more information about tags in Lightsail, see the Lightsail Developer Guide.

        This parameter is returned only by the GetSubdomains action when you specify a subdomain.

        • (dict) –

          Describes a tag key and optional value assigned to an Amazon Lightsail resource.

          For more information about tags in Lightsail, see the Amazon Lightsail Developer Guide.

          • key (string) –

            The key of the tag.

            Constraints: Tag keys accept a maximum of 128 letters, numbers, spaces in UTF-8, or the following characters: + - = . _ : / @

          • value (string) –

            The value of the tag.

            Constraints: Tag values accept a maximum of 256 letters, numbers, spaces in UTF-8, or the following characters: + - = . _ : / @

    • operation (dict) –

      An object that describes the result of the action, such as the status of the request, the timestamp of the request, and the resources affected by the request.

      • id (string) –

        The ID of the operation.

      • resourceName (string) –

        The resource name.

      • resourceType (string) –

        The resource type.

      • createdAt (datetime) –

        The timestamp when the operation was initialized ( 1479816991.349).

      • location (dict) –

        The Amazon Web Services Region and Availability Zone.

        • availabilityZone (string) –

          The Availability Zone. Follows the format us-east-2a (case-sensitive).

        • regionName (string) –

          The Amazon Web Services Region name.

      • isTerminal (boolean) –

        A Boolean value indicating whether the operation is terminal.

      • operationDetails (string) –

        Details about the operation ( Debian-1GB-Ohio-1).

      • operationType (string) –

        The type of operation.

      • status (string) –

        The status of the operation.

      • statusChangedAt (datetime) –

        The timestamp when the status was changed ( 1479816991.349).

      • errorCode (string) –

        The error code.

      • errorDetails (string) –

        The error details.

Exceptions