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.
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:AttachCertificateToDistributionon 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.
-
Sign in to the Lightsail console
. -
In the left navigation pane, choose Lightsail web addresses.
-
Choose the vertical ellipsis (⋮) icon next to the web address that you want to detach, and then choose Detach.
-
Choose Detach to confirm.
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.
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.
-
Sign in to the Lightsail console
. -
In the left navigation pane, choose Lightsail web addresses.
-
Choose the vertical ellipsis (⋮) icon next to the web address that you want to transfer, and then choose Transfer to another resource.
-
For Select distribution, choose the resource to transfer the web address to.
-
Choose Transfer web address.
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.
In the Lightsail API and AWS CLI, web addresses are called subdomains.
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.
-
Open a Terminal, AWS CloudShell, or Command Prompt window.
-
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-nameDistributionName--region us-east-1In the command, replace
DistributionNamewith the name of the distribution. Make a note of thearnvalue in the output. -
Enter one of the following commands:
-
To detach a web address from its distribution:
aws lightsail update-subdomain-association --subdomain-nameSubdomainName--action DISASSOCIATE --region us-east-1 -
To transfer a web address to a different distribution:
aws lightsail update-subdomain-association --subdomain-nameSubdomainName--action TRANSFER --target-resource-arnDistributionArn--region us-east-1
In the command, replace
SubdomainNamewith the name of your web address, such asmysite, andDistributionArnwith the ARN of the distribution.The command returns your web address with the
DETACHINGorTRANSFERRINGstate, and an operation. -
-
Enter the following command to confirm the state of your web address.
aws lightsail get-subdomains --subdomain-nameSubdomainName--region us-east-1