View a markdown version of this page

Detach or transfer a Lightsail web address - Amazon Lightsail

Detach or transfer a Lightsail web address

Detach a Lightsail web address when you no longer want it to serve a resource, or transfer it to a different resource, for example a new distribution that replaces your current one.

Note

Each month, you get 24 hours of free unattached web address time. After that, we charge USD $1 per month for each unattached web address. For more information, see What do Lightsail web addresses cost?.

Prerequisites

  • To transfer a web address, the resource that you transfer it to must meet the same prerequisites as an attach. For more information, see Prerequisites.

  • If you use IAM policies to control access to Lightsail, you need the following permissions:

    • lightsail:UpdateSubdomainAssociation – To detach or transfer a web address.

    • lightsail:DetachCertificateFromDistribution – To detach or transfer a web address.

    • lightsail:AttachCertificateToDistribution on the distribution – To transfer a web address.

    For more information, see Grant least-privilege permissions with IAM identity policies in Lightsail.

Detach a web address using the Lightsail console

When you detach a web address, it stops working within a few minutes, and your distribution will only be reachable using its default domain. Your web address will keep its name and will have the Unattached status. If you no longer need the web address, delete it. For instructions, see Delete a Lightsail web address.

  1. Sign in to the Lightsail console.

  2. In the left navigation pane, choose Lightsail web addresses.

  3. Choose the vertical ellipsis (⋮) icon next to the web address that you want to detach, and then choose Detach.

  4. Choose Detach to confirm.

    The Detach web address dialog for mysite.amazonlightsail.com, with the Detach button.

Transfer a web address using the Lightsail console

Transfer a web address to move it to a different distribution in one step, for example when you replace a distribution. You don't need to detach it first, and because it stays attached through the move, it won't incur charges. When you transfer a web address, Lightsail detaches it from its current distribution and attaches it to the distribution that you choose.

Note

A transfer usually takes 5 to 15 minutes, and your web address is unavailable during the transfer.

You can transfer a web address once every 24 hours. This limit applies to each web address, not to your account.

  1. Sign in to the Lightsail console.

  2. In the left navigation pane, choose Lightsail web addresses.

  3. Choose the vertical ellipsis (⋮) icon next to the web address that you want to transfer, and then choose Transfer to another resource.

  4. For Select distribution, choose the resource to transfer the web address to.

  5. Choose Transfer web address.

    The Transfer web address dialog for mysite.amazonlightsail.com, with my-new-distribution selected.

If a transfer fails

If a transfer fails before Lightsail detaches your web address from its current distribution, your web address stays attached to that distribution. If the transfer fails after Lightsail detaches it, your web address has the Unattached status, and it's charged while it's unattached. Attach it to a distribution again. For instructions, see Create and attach a Lightsail web address.

Detach or transfer a web address using the AWS CLI

Complete the following procedure to detach or transfer a web address using the AWS CLI. For more information, see update-subdomain-association in the AWS CLI Command Reference.

Note

In the Lightsail API and AWS CLI, web addresses are called subdomains.

Note

You can run the following commands in AWS CloudShell. CloudShell is a browser-based, pre-authenticated shell that you can launch directly from the Lightsail console. With CloudShell, you can run AWS CLI commands using your preferred shell, such as Bash, PowerShell, or Z shell, without downloading or installing command line tools. For more information, see Manage Lightsail resources with AWS CloudShell.

To use the AWS CLI on your own computer, install and configure it first. For instructions, see Set up and configure the AWS CLI for Lightsail operations.

  1. Open a Terminal, AWS CloudShell, or Command Prompt window.

  2. To transfer a web address, enter the following command to get the Amazon Resource Name (ARN) of the distribution to transfer it to.

    aws lightsail get-distributions --distribution-name DistributionName --region us-east-1

    In the command, replace DistributionName with the name of the distribution. Make a note of the arn value in the output.

  3. Enter one of the following commands:

    • To detach a web address from its distribution:

      aws lightsail update-subdomain-association --subdomain-name SubdomainName --action DISASSOCIATE --region us-east-1
    • To transfer a web address to a different distribution:

      aws lightsail update-subdomain-association --subdomain-name SubdomainName --action TRANSFER --target-resource-arn DistributionArn --region us-east-1

    In the command, replace SubdomainName with the name of your web address, such as mysite, and DistributionArn with the ARN of the distribution.

    The command returns your web address with the DETACHING or TRANSFERRING state, and an operation.

  4. Enter the following command to confirm the state of your web address.

    aws lightsail get-subdomains --subdomain-name SubdomainName --region us-east-1