CreateDeployment - Amazon API Gateway

CreateDeployment

Creates a Deployment resource, which makes a specified RestApi callable over the internet.

Request Syntax

POST /restapis/restapi_id/deployments HTTP/1.1 Content-type: application/json { "cacheClusterEnabled": boolean, "cacheClusterSize": "string", "canarySettings": { "percentTraffic": number, "stageVariableOverrides": { "string" : "string" }, "useStageCache": boolean }, "description": "string", "stageDescription": "string", "stageName": "string", "tracingEnabled": boolean, "variables": { "string" : "string" } }

URI Request Parameters

The request uses the following URI parameters.

restapi_id

The string identifier of the associated RestApi.

Required: Yes

Request Body

The request accepts the following data in JSON format.

cacheClusterEnabled

Enables a cache cluster for the Stage resource specified in the input.

Type: Boolean

Required: No

cacheClusterSize

The stage's cache capacity in GB. For more information about choosing a cache size, see Enabling API caching to enhance responsiveness.

Type: String

Valid Values: 0.5 | 1.6 | 6.1 | 13.5 | 28.4 | 58.2 | 118 | 237

Required: No

canarySettings

The input configuration for the canary deployment when the deployment is a canary release deployment.

Type: DeploymentCanarySettings object

Required: No

description

The description for the Deployment resource to create.

Type: String

Required: No

stageDescription

The description of the Stage resource for the Deployment resource to create.

Type: String

Required: No

stageName

The name of the Stage resource for the Deployment resource to create.

Type: String

Required: No

tracingEnabled

Specifies whether active tracing with X-ray is enabled for the Stage.

Type: Boolean

Required: No

variables

A map that defines the stage variables for the Stage resource that is associated with the new deployment. Variable names can have alphanumeric and underscore characters, and the values must match [A-Za-z0-9-._~:/?#&=,]+.

Type: String to string map

Required: No

Response Syntax

HTTP/1.1 201 Content-type: application/json { "apiSummary": { "string" : { "string" : { "apiKeyRequired": boolean, "authorizationType": "string" } } }, "createdDate": number, "description": "string", "id": "string" }

Response Elements

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

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

apiSummary

A summary of the RestApi at the date and time that the deployment resource was created.

Type: String to string to MethodSnapshot object map map

createdDate

The date and time that the deployment resource was created.

Type: Timestamp

description

The description for the deployment resource.

Type: String

id

The identifier for the deployment resource.

Type: String

Errors

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

BadRequestException

The submitted request is not valid, for example, the input is incomplete or incorrect. See the accompanying error message for details.

HTTP Status Code: 400

ConflictException

The request configuration has conflicts. For details, see the accompanying error message.

HTTP Status Code: 409

LimitExceededException

The request exceeded the rate limit. Retry after the specified time period.

HTTP Status Code: 429

NotFoundException

The requested resource is not found. Make sure that the request URI is correct.

HTTP Status Code: 404

ServiceUnavailableException

The requested service is not available. For details see the accompanying error message. Retry after the specified time period.

HTTP Status Code: 503

TooManyRequestsException

The request has reached its throttling limit. Retry after the specified time period.

HTTP Status Code: 429

UnauthorizedException

The request is denied because the caller has insufficient permissions.

HTTP Status Code: 401

Examples

Create a deployment of an API

This example illustrates one usage of CreateDeployment.

Sample Request

POST /restapis/fugvjdxtri/deployments HTTP/1.1 Content-Type: application/json Host: apigateway.us-east-1.amazonaws.com X-Amz-Date: 20160603T175605Z Authorization: AWS4-HMAC-SHA256 Credential={access_key_ID}/20160603/us-east-1/apigateway/aws4_request, SignedHeaders=content-length;content-type;host;x-amz-date, Signature={sig4_hash} { "stageName" : "stage1", "stageDescription" : "First stage", "description" : "First deployment", "cacheClusterEnabled" : "false", "variables" : { "sv1" : "opVar" } }

Sample Response

{ "_links": { "curies": { "href": "https://docs.aws.amazon.com/apigateway/latest/developerguide/restapi-deployment-{rel}.html", "name": "deployment", "templated": true }, "self": { "href": "/restapis/fugvjdxtri/deployments/dzacq7" }, "deployment:delete": { "href": "/restapis/fugvjdxtri/deployments/dzacq7" }, "deployment:stages": { "href": "/restapis/fugvjdxtri/stages?deployment_id=dzacq7" }, "deployment:update": { "href": "/restapis/fugvjdxtri/deployments/dzacq7" } }, "createdDate": "2016-06-03T17:56:06Z", "description": "First deployment", "id": "dzacq7" }

See Also

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