AddDraftAppVersionResourceMappings - AWS Resilience Hub

AddDraftAppVersionResourceMappings

Adds the source of resource-maps to the draft version of an application. During assessment, AWS Resilience Hub will use these resource-maps to resolve the latest physical ID for each resource in the application template. For more information about different types of resources suported by AWS Resilience Hub and how to add them in your application, see Step 2: How is your application managed? in the AWS Resilience Hub User Guide.

Request Syntax

POST /add-draft-app-version-resource-mappings HTTP/1.1 Content-type: application/json { "appArn": "string", "resourceMappings": [ { "appRegistryAppName": "string", "eksSourceName": "string", "logicalStackName": "string", "mappingType": "string", "physicalResourceId": { "awsAccountId": "string", "awsRegion": "string", "identifier": "string", "type": "string" }, "resourceGroupName": "string", "resourceName": "string", "terraformSourceName": "string" } ] }

URI Request Parameters

The request does not use any URI parameters.

Request Body

The request accepts the following data in JSON format.

appArn

Amazon Resource Name (ARN) of the AWS Resilience Hub application. The format for this ARN is: arn:partition:resiliencehub:region:account:app/app-id. For more information about ARNs, see Amazon Resource Names (ARNs) in the AWS General Reference guide.

Type: String

Pattern: ^arn:(aws|aws-cn|aws-iso|aws-iso-[a-z]{1}|aws-us-gov):[A-Za-z0-9][A-Za-z0-9_/.-]{0,62}:([a-z]{2}-((iso[a-z]{0,1}-)|(gov-)){0,1}[a-z]+-[0-9]):[0-9]{12}:[A-Za-z0-9/][A-Za-z0-9:_/+.-]{0,1023}$

Required: Yes

resourceMappings

Mappings used to map logical resources from the template to physical resources. You can use the mapping type CFN_STACK if the application template uses a logical stack name. Or you can map individual resources by using the mapping type RESOURCE. We recommend using the mapping type CFN_STACK if the application is backed by a CloudFormation stack.

Type: Array of ResourceMapping objects

Required: Yes

Response Syntax

HTTP/1.1 200 Content-type: application/json { "appArn": "string", "appVersion": "string", "resourceMappings": [ { "appRegistryAppName": "string", "eksSourceName": "string", "logicalStackName": "string", "mappingType": "string", "physicalResourceId": { "awsAccountId": "string", "awsRegion": "string", "identifier": "string", "type": "string" }, "resourceGroupName": "string", "resourceName": "string", "terraformSourceName": "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.

appArn

Amazon Resource Name (ARN) of the AWS Resilience Hub application. The format for this ARN is: arn:partition:resiliencehub:region:account:app/app-id. For more information about ARNs, see Amazon Resource Names (ARNs) in the AWS General Reference guide.

Type: String

Pattern: ^arn:(aws|aws-cn|aws-iso|aws-iso-[a-z]{1}|aws-us-gov):[A-Za-z0-9][A-Za-z0-9_/.-]{0,62}:([a-z]{2}-((iso[a-z]{0,1}-)|(gov-)){0,1}[a-z]+-[0-9]):[0-9]{12}:[A-Za-z0-9/][A-Za-z0-9:_/+.-]{0,1023}$

appVersion

The version of the application.

Type: String

Pattern: ^\S{1,50}$

resourceMappings

List of sources that are used to map a logical resource from the template to a physical resource. You can use sources such as AWS CloudFormation, Terraform state files, AppRegistry applications, or Amazon EKS.

Type: Array of ResourceMapping objects

Errors

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

AccessDeniedException

You don't have permissions to perform the requested operation. The user or role that is making the request must have at least one IAM permissions policy attached that grants the required permissions.

HTTP Status Code: 403

ConflictException

This exception occurs when a conflict with a previous successful write is detected. This generally occurs when the previous write did not have time to propagate to the host serving the current request. A retry (with appropriate backoff logic) is the recommended response to this exception.

HTTP Status Code: 409

InternalServerException

This exception occurs when there is an internal failure in the AWS Resilience Hub service.

HTTP Status Code: 500

ResourceNotFoundException

This exception occurs when the specified resource could not be found.

HTTP Status Code: 404

ThrottlingException

This exception occurs when you have exceeded the limit on the number of requests per second.

HTTP Status Code: 429

ValidationException

This exception occurs when a request is not valid.

HTTP Status Code: 400

Examples

Example CloudFormation Request

The following is an example request payload.

Sample Request

{ "appArn": "arn:aws:resiliencehub:us-west-2:444455556666:app/dd058443-7e2f-410d-bee6-c634cb3edb39", "resourceMappings": [ { "logicalStackName": "my-stack-name", "mappingType": "CfnStack", "physicalResourceId": { "identifier": "arn:aws:cloudformation:us-west-2:444455556666:stack/my-stack-name/fe0e1e00-03eb-11ee-8796-02038f8a9691", "type": "Arn" } } ] }

Sample CloudFormation Response

The following is an example response payload.

Sample Response

{ "appArn": "arn:aws:resiliencehub:us-west-2:444455556666:app/dd058443-7e2f-410d-bee6-c634cb3edb39", "appVersion": "draft", "resourceMappings": [ { "logicalStackName": "my-stack-name", "mappingType": "CfnStack", "physicalResourceId": { "identifier": "arn:aws:cloudformation:us-west-2:444455556666:stack/my-stack-name/fe0e1e00-03eb-11ee-8796-02038f8a9691", "type": "Arn" } } ] }

Example Terraform Request

The following is an example request payload.

Sample Request

{ "appArn": " arn:aws:resiliencehub:us-west-2:444455556666:app/4019253a-0c99-4d30-be32-b14dd46d1c3d", "resourceMappings": [ { "mappingType": "Terraform", "physicalResourceId": { "awsAccountId": "444455556666", "awsRegion": "us-west-2", "identifier": "s3://my-terraform-bucket/my/path/application-state-file.tfstate", "type": "Native" }, } ] }

Sample Terraform Response

The following is an example response payload.

Sample Response

{ "appArn": "arn:aws:resiliencehub:us-west-2:444455556666:app/4019253a-0c99-4d30-be32-b14dd46d1c3d", "resourceMappings": [ { "terraformSourceName": "application-state-file.tfstate", "mappingType": "Terraform", "physicalResourceId": { "identifier": "s3://terraform-bucket/web-app/latest/application-state-file.tfstate", "type": "Native", "awsRegion": "us-west-2", "awsAccountId": "444455556666" } } ] }

Sample AppRegistry Request

The following is an example request payload.

Sample Request

{ "appArn": "arn:aws:resiliencehub:us-west-2:444455556666:app/4019253a-0c99-4d30-be32-b14dd46d1c3d", "resourceMappings": [ { "appRegistryAppName": "MyWebApp", "mappingType": "AppRegistryApp", "physicalResourceId": { "identifier": "arn:aws:servicecatalog:us-west-2:444455556666:/applications/123456789012abcdefghijklmnop", "type": "ARN" }, } ] }

Sample AppRegistry Response

The following is an example response payload.

Sample Response

{ "appArn": "aws:resiliencehub:us-west-2:444455556666:app/4019253a-0c99-4d30-be32-b14dd46d1c3d", "resourceMappings": [ { "appRegistryAppName": "MyWebApp", "mappingType": "AppRegistryApp", "physicalResourceId": { "identifier": "arn:aws:servicecatalog:us-west-2:444455556666:/applications/123456789012abcdefghijklmnop", "type": "Arn" } } ] }

Sample Amazon EKS Request

The following is an example request payload.

Sample Request

{ "appArn": "arn:aws:resiliencehub:us-west-2:444455556666:app/98f97a67-228f-40b3-8b2b-29da919c68cc", "resourceMappings": [ { "eksSourceName": "my-cluster/my-namespace", "mappingType": "EKS", "physicalResourceId": { "identifier": "arn:aws:eks:us-west-2:444455556666:cluster/my-cluster/my-namespace", "type": "Arn" }, } ] }

Sample Amazon EKS Response

The following is an example response payload.

Sample Response

{ "appArn": "arn:aws:resiliencehub:us-west-2:444455556666:app/98f97a67-228f-40b3-8b2b-29da919c68cc", "resourceMappings": [ { "eksSourceName": "my-cluster/my-namespace", "mappingType": "EKS", "physicalResourceId": { "identifier": "arn:aws:eks:us-west-2:444455556666:cluster/my-cluster/my-namespace", "type": "Arn" }, } ] }

See Also

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