How do I copy a WorkSpaces image to another account?

Last updated: 2020-09-24

I want to transfer an Amazon WorkSpaces image to another account in the same Region. How can I do that?

Resolution

You can use API calls to self-manage WorkSpaces image transfers to other accounts in the same Region.

Important: The commands in the following process require version 2 of the AWS Command Line Interface (AWS CLI). For installation instructions, see Installing the AWS CLI version 2.

To copy a WorkSpaces image to a different account within the same Region, follow these steps:

1.    From the source account, identify the image ID for the source image. Run the following command, replacing region-code with the WorkSpaces Region code, and note the ImageId from the output:

aws workspaces describe-workspace-images --region region-code

2.    From the source account, call the UpdateWorkspaceImagePermission API to share the source image with the target account. Run the following command, replacing ImageId with the output from step 1, region-code with the WorkSpaces Region code, and target-account with the target account number:

aws workspaces update-workspace-image-permission --image-id ImageId --region region-code --shared-account-id target-account --allow-copy-image

3.    (Optional) From the source account, call the DescribeWorkspaceImagePermissions API to view the permissions and verify that the image is shared with the target account. Run the following command, replacing ImageId and region-code with your values:

aws workspaces describe-workspace-image-permissions --image-id ImageId --region region-code

4.    (Optional) From the target account, call the DescribeWorkspaceImages API to view the shared image. Run the following command, replacing ImageId and region-code with your values:

aws workspaces describe-workspace-images --image-ids ImageId --region region-code --image-type SHARED

5.    From the target account, call the CopyWorkspaceImage API to copy the shared image. Run the following command, replacing ImageId and region-code with your values. Also, replace new-image-name with the name that you want to use for the image on the target account:

aws workspaces copy-workspace-image --source-image-id ImageId --source-region region-code --name new-image-name --region region-code

The target account can now see the new image in the Amazon WorkSpaces console. The image state moves from Pending to Available after the workflow is complete, which typically takes about 15 minutes.


Did this article help?


Do you need billing or technical support?