Skip to content
GitHubXDiscord

Environment

The Environment resource lets you manage AWS RefactorSpaces Environments that facilitate the migration of applications to the cloud by providing a secure and isolated environment for your services.

Create a basic RefactorSpaces Environment with a name and description:

import AWS from "alchemy/aws/control";
const refactorEnvironment = await AWS.RefactorSpaces.Environment("myRefactorEnvironment", {
name: "MyRefactorEnvironment",
description: "An environment for migrating my application",
tags: [
{ key: "Project", value: "Migration" },
{ key: "Owner", value: "DevTeam" }
]
});

Configure an environment with a specific network fabric type and additional tags:

const advancedEnvironment = await AWS.RefactorSpaces.Environment("advancedRefactorEnvironment", {
name: "AdvancedRefactorEnvironment",
description: "An advanced environment with specific networking",
networkFabricType: "VPC", // Options include 'VPC', 'TransitGateway', etc.
tags: [
{ key: "Environment", value: "Production" },
{ key: "Owner", value: "OpsTeam" }
]
});

If you want to adopt an existing environment instead of failing when it already exists, you can set the adopt property to true:

const adoptedEnvironment = await AWS.RefactorSpaces.Environment("adoptedRefactorEnvironment", {
name: "AdoptedRefactorEnvironment",
description: "Adopting an existing RefactorSpaces environment",
adopt: true
});

Create an environment with specific network configurations using a custom CIDR block:

const customNetworkEnvironment = await AWS.RefactorSpaces.Environment("customNetworkRefactorEnvironment", {
name: "CustomNetworkRefactorEnvironment",
description: "Environment with custom network settings",
networkFabricType: "VPC",
tags: [
{ key: "NetworkType", value: "Custom" }
]
});