- Navigation GuideYou are on a Command (operation) page with structural examples. Use the navigation breadcrumb if you would like to return to the Client landing page.
CopyWorkspaceImageCommand
Copies the specified image from the specified Region to the current Region. For more information about copying images, see Copy a Custom WorkSpaces Image .
In the China (Ningxia) Region, you can copy images only within the same Region.
In Amazon Web Services GovCloud (US), to copy images to and from other Regions, contact Amazon Web ServicesSupport.
Before copying a shared image, be sure to verify that it has been shared from the correct Amazon Web Services account. To determine if an image has been shared and to see the ID of the Amazon Web Services account that owns an image, use the DescribeWorkSpaceImages and DescribeWorkspaceImagePermissions API operations.
Example Syntax
Use a bare-bones client and the command you need to make an API call.
import { WorkSpacesClient, CopyWorkspaceImageCommand } from "@aws-sdk/client-workspaces"; // ES Modules import
// const { WorkSpacesClient, CopyWorkspaceImageCommand } = require("@aws-sdk/client-workspaces"); // CommonJS import
const client = new WorkSpacesClient(config);
const input = { // CopyWorkspaceImageRequest
Name: "STRING_VALUE", // required
Description: "STRING_VALUE",
SourceImageId: "STRING_VALUE", // required
SourceRegion: "STRING_VALUE", // required
Tags: [ // TagList
{ // Tag
Key: "STRING_VALUE", // required
Value: "STRING_VALUE",
},
],
};
const command = new CopyWorkspaceImageCommand(input);
const response = await client.send(command);
// { // CopyWorkspaceImageResult
// ImageId: "STRING_VALUE",
// };
CopyWorkspaceImageCommand Input
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|---|---|
Name Required | string | undefined | The name of the image. |
SourceImageId Required | string | undefined | The identifier of the source image. |
SourceRegion Required | string | undefined | The identifier of the source Region. |
Description | string | undefined | A description of the image. |
Tags | Tag[] | undefined | The tags for the image. |
CopyWorkspaceImageCommand Output
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|---|---|
$metadata Required | ResponseMetadata | Metadata pertaining to this request. |
ImageId | string | undefined | The identifier of the image. |
Throws
Name | Fault | Details |
---|
Name | Fault | Details |
---|---|---|
AccessDeniedException | client | The user is not authorized to access a resource. |
InvalidParameterValuesException | client | One or more parameter values are not valid. |
OperationNotSupportedException | client | This operation is not supported. |
ResourceAlreadyExistsException | client | The specified resource already exists. |
ResourceLimitExceededException | client | Your resource limits have been exceeded. |
ResourceNotFoundException | client | The resource could not be found. |
ResourceUnavailableException | client | The specified resource is not available. |
WorkSpacesServiceException | Base exception class for all service exceptions from WorkSpaces service. |