- 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.
CreateEnvironmentCommand
Creates an Amazon Web Services Migration Hub Refactor Spaces environment. The caller owns the environment resource, and all Refactor Spaces applications, services, and routes created within the environment. They are referred to as the environment owner. The environment owner has cross-account visibility and control of Refactor Spaces resources that are added to the environment by other accounts that the environment is shared with.
When creating an environment with a CreateEnvironment:NetworkFabricType of TRANSIT_GATEWAY
, Refactor Spaces provisions a transit gateway to enable services in VPCs to communicate directly across accounts. If CreateEnvironment:NetworkFabricType is NONE
, Refactor Spaces does not create a transit gateway and you must use your network infrastructure to route traffic to services with private URL endpoints.
Example Syntax
Use a bare-bones client and the command you need to make an API call.
import { MigrationHubRefactorSpacesClient, CreateEnvironmentCommand } from "@aws-sdk/client-migration-hub-refactor-spaces"; // ES Modules import
// const { MigrationHubRefactorSpacesClient, CreateEnvironmentCommand } = require("@aws-sdk/client-migration-hub-refactor-spaces"); // CommonJS import
const client = new MigrationHubRefactorSpacesClient(config);
const input = { // CreateEnvironmentRequest
Name: "STRING_VALUE", // required
Description: "STRING_VALUE",
NetworkFabricType: "STRING_VALUE", // required
Tags: { // TagMap
"<keys>": "STRING_VALUE",
},
ClientToken: "STRING_VALUE",
};
const command = new CreateEnvironmentCommand(input);
const response = await client.send(command);
// { // CreateEnvironmentResponse
// Name: "STRING_VALUE",
// Arn: "STRING_VALUE",
// Description: "STRING_VALUE",
// EnvironmentId: "STRING_VALUE",
// NetworkFabricType: "STRING_VALUE",
// OwnerAccountId: "STRING_VALUE",
// State: "STRING_VALUE",
// Tags: { // TagMap
// "<keys>": "STRING_VALUE",
// },
// LastUpdatedTime: new Date("TIMESTAMP"),
// CreatedTime: new Date("TIMESTAMP"),
// };
CreateEnvironmentCommand Input
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|---|---|
Name Required | string | undefined | The name of the environment. |
NetworkFabricType Required | NetworkFabricType | undefined | The network fabric type of the environment. |
ClientToken | string | undefined | A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. |
Description | string | undefined | The description of the environment. |
Tags | Record<string, string> | undefined | The tags to assign to the environment. A tag is a label that you assign to an Amazon Web Services resource. Each tag consists of a key-value pair. |
CreateEnvironmentCommand Output
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|---|---|
$metadata Required | ResponseMetadata | Metadata pertaining to this request. |
Arn | string | undefined | The Amazon Resource Name (ARN) of the environment. |
CreatedTime | Date | undefined | A timestamp that indicates when the environment is created. |
Description | string | undefined | A description of the environment. |
EnvironmentId | string | undefined | The unique identifier of the environment. |
LastUpdatedTime | Date | undefined | A timestamp that indicates when the environment was last updated. |
Name | string | undefined | The name of the environment. |
NetworkFabricType | NetworkFabricType | undefined | The network fabric type of the environment. |
OwnerAccountId | string | undefined | The Amazon Web Services account ID of environment owner. |
State | EnvironmentState | undefined | The current state of the environment. |
Tags | Record<string, string> | undefined | The tags assigned to the created environment. A tag is a label that you assign to an Amazon Web Services resource. Each tag consists of a key-value pair.. |
Throws
Name | Fault | Details |
---|
Name | Fault | Details |
---|---|---|
AccessDeniedException | client | The user does not have sufficient access to perform this action. |
ConflictException | client | Updating or deleting a resource can cause an inconsistent state. |
InternalServerException | server | An unexpected error occurred while processing the request. |
ResourceNotFoundException | client | The request references a resource that does not exist. |
ServiceQuotaExceededException | client | The request would cause a service quota to be exceeded. |
ThrottlingException | client | Request was denied because the request was throttled. |
ValidationException | client | The input does not satisfy the constraints specified by an Amazon Web Service. |
MigrationHubRefactorSpacesServiceException | Base exception class for all service exceptions from MigrationHubRefactorSpaces service. |