CreateRoute - AWS Migration Hub Refactor Spaces

CreateRoute

Creates an AWS Migration Hub Refactor Spaces route. The account owner of the service resource is always the environment owner, regardless of which account creates the route. Routes target a service in the application. If an application does not have any routes, then the first route must be created as a DEFAULT RouteType.

When created, the default route defaults to an active state so state is not a required input. However, like all other state values the state of the default route can be updated after creation, but only when all other routes are also inactive. Conversely, no route can be active without the default route also being active.

When you create a route, Refactor Spaces configures the Amazon API Gateway to send traffic to the target service as follows:

  • If the service has a URL endpoint, and the endpoint resolves to a private IP address, Refactor Spaces routes traffic using the API Gateway VPC link.

  • If the service has a URL endpoint, and the endpoint resolves to a public IP address, Refactor Spaces routes traffic over the public internet.

  • If the service has an AWS Lambda function endpoint, then Refactor Spaces configures the Lambda function's resource policy to allow the application's API Gateway to invoke the function.

A one-time health check is performed on the service when either the route is updated from inactive to active, or when it is created with an active state. If the health check fails, the route transitions the route state to FAILED, an error code of SERVICE_ENDPOINT_HEALTH_CHECK_FAILURE is provided, and no traffic is sent to the service.

For Lambda functions, the Lambda function state is checked. If the function is not active, the function configuration is updated so that Lambda resources are provisioned. If the Lambda state is Failed, then the route creation fails. For more information, see the GetFunctionConfiguration's State response parameter in the AWS Lambda Developer Guide.

For Lambda endpoints, a check is performed to determine that a Lambda function with the specified ARN exists. If it does not exist, the health check fails. For public URLs, a connection is opened to the public endpoint. If the URL is not reachable, the health check fails.

For private URLS, a target group is created on the Elastic Load Balancing and the target group health check is run. The HealthCheckProtocol, HealthCheckPort, and HealthCheckPath are the same protocol, port, and path specified in the URL or health URL, if used. All other settings use the default values, as described in Health checks for your target groups. The health check is considered successful if at least one target within the target group transitions to a healthy state.

Services can have HTTP or HTTPS URL endpoints. For HTTPS URLs, publicly-signed certificates are supported. Private Certificate Authorities (CAs) are permitted only if the CA's domain is also publicly resolvable.

Request Syntax

POST /environments/EnvironmentIdentifier/applications/ApplicationIdentifier/routes HTTP/1.1 Content-type: application/json { "ClientToken": "string", "DefaultRoute": { "ActivationState": "string" }, "RouteType": "string", "ServiceIdentifier": "string", "Tags": { "string" : "string" }, "UriPathRoute": { "ActivationState": "string", "IncludeChildPaths": boolean, "Methods": [ "string" ], "SourcePath": "string" } }

URI Request Parameters

The request uses the following URI parameters.

ApplicationIdentifier

The ID of the application within which the route is being created.

Length Constraints: Fixed length of 14.

Pattern: ^app-[0-9A-Za-z]{10}$

Required: Yes

EnvironmentIdentifier

The ID of the environment in which the route is created.

Length Constraints: Fixed length of 14.

Pattern: ^env-[0-9A-Za-z]{10}$

Required: Yes

Request Body

The request accepts the following data in JSON format.

ClientToken

A unique, case-sensitive identifier that you provide to ensure the idempotency of the request.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 64.

Pattern: ^[\x20-\x7E]{1,64}$

Required: No

DefaultRoute

Configuration for the default route type.

Type: DefaultRouteInput object

Required: No

RouteType

The route type of the route. DEFAULT indicates that all traffic that does not match another route is forwarded to the default route. Applications must have a default route before any other routes can be created. URI_PATH indicates a route that is based on a URI path.

Type: String

Valid Values: DEFAULT | URI_PATH

Required: Yes

ServiceIdentifier

The ID of the service in which the route is created. Traffic that matches this route is forwarded to this service.

Type: String

Length Constraints: Fixed length of 14.

Pattern: ^svc-[0-9A-Za-z]{10}$

Required: Yes

Tags

The tags to assign to the route. A tag is a label that you assign to an AWS resource. Each tag consists of a key-value pair..

Type: String to string map

Map Entries: Minimum number of 0 items. Maximum number of 50 items.

Key Length Constraints: Minimum length of 1. Maximum length of 128.

Key Pattern: ^(?!aws:).+

Value Length Constraints: Minimum length of 0. Maximum length of 256.

Required: No

UriPathRoute

The configuration for the URI path route type.

Type: UriPathRouteInput object

Required: No

Response Syntax

HTTP/1.1 200 Content-type: application/json { "ApplicationId": "string", "Arn": "string", "CreatedByAccountId": "string", "CreatedTime": number, "LastUpdatedTime": number, "OwnerAccountId": "string", "RouteId": "string", "RouteType": "string", "ServiceId": "string", "State": "string", "Tags": { "string" : "string" }, "UriPathRoute": { "ActivationState": "string", "IncludeChildPaths": boolean, "Methods": [ "string" ], "SourcePath": "string" } }

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

ApplicationId

The ID of the application in which the route is created.

Type: String

Length Constraints: Fixed length of 14.

Pattern: ^app-[0-9A-Za-z]{10}$

Arn

The Amazon Resource Name (ARN) of the route. The format for this ARN is arn:aws:refactor-spaces:region:account-id:resource-type/resource-id . For more information about ARNs, see Amazon Resource Names (ARNs) in the AWS General Reference.

Type: String

Length Constraints: Minimum length of 20. Maximum length of 2048.

Pattern: ^arn:aws:refactor-spaces:[a-zA-Z0-9\-]+:\w{12}:[a-zA-Z_0-9+=,.@\-_/]+$

CreatedByAccountId

The AWS account ID of the route creator.

Type: String

Length Constraints: Fixed length of 12.

Pattern: ^\d{12}$

CreatedTime

A timestamp that indicates when the route is created.

Type: Timestamp

LastUpdatedTime

A timestamp that indicates when the route was last updated.

Type: Timestamp

OwnerAccountId

The AWS account ID of the route owner.

Type: String

Length Constraints: Fixed length of 12.

Pattern: ^\d{12}$

RouteId

The unique identifier of the route.

Type: String

Length Constraints: Fixed length of 14.

Pattern: ^rte-[0-9A-Za-z]{10}$

RouteType

The route type of the route.

Type: String

Valid Values: DEFAULT | URI_PATH

ServiceId

The ID of service in which the route is created. Traffic that matches this route is forwarded to this service.

Type: String

Length Constraints: Fixed length of 14.

Pattern: ^svc-[0-9A-Za-z]{10}$

State

The current state of the route. Activation state only allows ACTIVE or INACTIVE as user inputs. FAILED is a route state that is system generated.

Type: String

Valid Values: CREATING | ACTIVE | DELETING | FAILED | UPDATING | INACTIVE

Tags

The tags assigned to the created route. A tag is a label that you assign to an AWS resource. Each tag consists of a key-value pair.

Type: String to string map

Map Entries: Minimum number of 0 items. Maximum number of 50 items.

Key Length Constraints: Minimum length of 1. Maximum length of 128.

Key Pattern: ^(?!aws:).+

Value Length Constraints: Minimum length of 0. Maximum length of 256.

UriPathRoute

Configuration for the URI path route type.

Type: UriPathRouteInput object

Errors

For information about the errors that are common to all actions, see Common Errors.

AccessDeniedException

The user does not have sufficient access to perform this action.

HTTP Status Code: 403

ConflictException

Updating or deleting a resource can cause an inconsistent state.

HTTP Status Code: 409

InternalServerException

An unexpected error occurred while processing the request.

HTTP Status Code: 500

ResourceNotFoundException

The request references a resource that does not exist.

HTTP Status Code: 404

ServiceQuotaExceededException

The request would cause a service quota to be exceeded.

HTTP Status Code: 402

ThrottlingException

Request was denied because the request was throttled.

HTTP Status Code: 429

ValidationException

The input does not satisfy the constraints specified by an AWS service.

HTTP Status Code: 400

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: