Skip to content
GitHubXDiscord

Route

The Route resource lets you manage AWS RefactorSpaces Routes for directing traffic to various services in your application. This resource allows you to define the environment and application context for your routes.

Create a basic route with required properties and a default route configuration.

import AWS from "alchemy/aws/control";
const basicRoute = await AWS.RefactorSpaces.Route("basicRoute", {
EnvironmentIdentifier: "env-123456",
ApplicationIdentifier: "app-abcde",
ServiceIdentifier: "service-xyz",
RouteType: "URI_PATH",
DefaultRoute: {
Status: "ACTIVE",
Priority: 1
}
});

Configure a route with a URI path route specification and additional tags.

const advancedRoute = await AWS.RefactorSpaces.Route("advancedRoute", {
EnvironmentIdentifier: "env-123456",
ApplicationIdentifier: "app-abcde",
ServiceIdentifier: "service-xyz",
RouteType: "URI_PATH",
UriPathRoute: {
Path: "/api/v1/resource",
Methods: ["GET", "POST"]
},
Tags: [
{ Key: "Project", Value: "RefactorSpaces" },
{ Key: "Environment", Value: "Production" }
]
});

Create a route that specifies a detailed URI path and supports multiple HTTP methods.

const detailedUriRoute = await AWS.RefactorSpaces.Route("detailedUriRoute", {
EnvironmentIdentifier: "env-123456",
ApplicationIdentifier: "app-abcde",
ServiceIdentifier: "service-xyz",
RouteType: "URI_PATH",
UriPathRoute: {
Path: "/api/v1/users",
Methods: ["GET", "POST", "DELETE"]
},
DefaultRoute: {
Status: "ACTIVE",
Priority: 2
}
});

Define a route that targets a specific service within an application.

const serviceRoute = await AWS.RefactorSpaces.Route("serviceRoute", {
EnvironmentIdentifier: "env-123456",
ApplicationIdentifier: "app-abcde",
ServiceIdentifier: "service-xyz",
RouteType: "DEFAULT",
DefaultRoute: {
Status: "ACTIVE",
Priority: 3
},
Tags: [
{ Key: "Service", Value: "UserManagement" }
]
});