CreateResourceCommand

Creates the specified resource. For more information, see Creating a resource  in the Amazon Web Services Cloud Control API User Guide.

After you have initiated a resource creation request, you can monitor the progress of your request by calling GetResourceRequestStatus  using the RequestToken of the ProgressEvent type returned by CreateResource.

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { CloudControlClient, CreateResourceCommand } from "@aws-sdk/client-cloudcontrol"; // ES Modules import
// const { CloudControlClient, CreateResourceCommand } = require("@aws-sdk/client-cloudcontrol"); // CommonJS import
const client = new CloudControlClient(config);
const input = { // CreateResourceInput
  TypeName: "STRING_VALUE", // required
  TypeVersionId: "STRING_VALUE",
  RoleArn: "STRING_VALUE",
  ClientToken: "STRING_VALUE",
  DesiredState: "STRING_VALUE", // required
};
const command = new CreateResourceCommand(input);
const response = await client.send(command);
// { // CreateResourceOutput
//   ProgressEvent: { // ProgressEvent
//     TypeName: "STRING_VALUE",
//     Identifier: "STRING_VALUE",
//     RequestToken: "STRING_VALUE",
//     HooksRequestToken: "STRING_VALUE",
//     Operation: "STRING_VALUE",
//     OperationStatus: "STRING_VALUE",
//     EventTime: new Date("TIMESTAMP"),
//     ResourceModel: "STRING_VALUE",
//     StatusMessage: "STRING_VALUE",
//     ErrorCode: "STRING_VALUE",
//     RetryAfter: new Date("TIMESTAMP"),
//   },
// };

CreateResourceCommand Input

See CreateResourceCommandInput for more details

Parameter
Type
Description
DesiredState
Required
string | undefined

Structured data format representing the desired state of the resource, consisting of that resource's properties and their desired values.

Cloud Control API currently supports JSON as a structured data format.

Specify the desired state as one of the following:

  • A JSON blob

  • A local path containing the desired state in JSON data format

For more information, see Composing the desired state of the resource  in the Amazon Web Services Cloud Control API User Guide.

For more information about the properties of a specific resource, refer to the related topic for the resource in the Resource and property types reference  in the CloudFormation Users Guide.

TypeName
Required
string | undefined

The name of the resource type.

ClientToken
string | undefined

A unique identifier to ensure the idempotency of the resource request. As a best practice, specify this token to ensure idempotency, so that Amazon Web Services Cloud Control API can accurately distinguish between request retries and new resource requests. You might retry a resource request to ensure that it was successfully received.

A client token is valid for 36 hours once used. After that, a resource request with the same client token is treated as a new request.

If you do not specify a client token, one is generated for inclusion in the request.

For more information, see Ensuring resource operation requests are unique  in the Amazon Web Services Cloud Control API User Guide.

RoleArn
string | undefined

The Amazon Resource Name (ARN) of the Identity and Access Management (IAM) role for Cloud Control API to use when performing this resource operation. The role specified must have the permissions required for this operation. The necessary permissions for each event handler are defined in the handlers  section of the resource type definition schema .

If you do not specify a role, Cloud Control API uses a temporary session created using your Amazon Web Services user credentials.

For more information, see Specifying credentials  in the Amazon Web Services Cloud Control API User Guide.

TypeVersionId
string | undefined

For private resource types, the type version to use in this resource operation. If you do not specify a resource version, CloudFormation uses the default version.

CreateResourceCommand Output

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
ProgressEvent
ProgressEvent | undefined

Represents the current status of the resource creation request.

After you have initiated a resource creation request, you can monitor the progress of your request by calling GetResourceRequestStatus  using the RequestToken of the ProgressEvent returned by CreateResource.

Throws

Name
Fault
Details
AlreadyExistsException
client

The resource with the name requested already exists.

ClientTokenConflictException
client

The specified client token has already been used in another resource request.

It's best practice for client tokens to be unique for each resource operation request. However, client token expire after 36 hours.

ConcurrentOperationException
client

Another resource operation is currently being performed on this resource.

GeneralServiceException
client

The resource handler has returned that the downstream service generated an error that doesn't map to any other handler error code.

HandlerFailureException
server

The resource handler has failed without a returning a more specific error code. This can include timeouts.

HandlerInternalFailureException
server

The resource handler has returned that an unexpected error occurred within the resource handler.

InvalidCredentialsException
client

The resource handler has returned that the credentials provided by the user are invalid.

InvalidRequestException
client

The resource handler has returned that invalid input from the user has generated a generic exception.

NetworkFailureException
server

The resource handler has returned that the request couldn't be completed due to networking issues, such as a failure to receive a response from the server.

NotStabilizedException
client

The resource handler has returned that the downstream resource failed to complete all of its ready-state checks.

NotUpdatableException
client

One or more properties included in this resource operation are defined as create-only, and therefore can't be updated.

PrivateTypeException
client

Cloud Control API hasn't received a valid response from the resource handler, due to a configuration error. This includes issues such as the resource handler returning an invalid response, or timing out.

ResourceConflictException
client

The resource is temporarily unavailable to be acted upon. For example, if the resource is currently undergoing an operation and can't be acted upon until that operation is finished.

ResourceNotFoundException
client

A resource with the specified identifier can't be found.

ServiceInternalErrorException
server

The resource handler has returned that the downstream service returned an internal error, typically with a 5XX HTTP status code.

ServiceLimitExceededException
client

The resource handler has returned that a non-transient resource limit was reached on the service side.

ThrottlingException
client

The request was denied due to request throttling.

TypeNotFoundException
client

The specified extension doesn't exist in the CloudFormation registry.

UnsupportedActionException
client

The specified resource doesn't support this resource operation.

CloudControlServiceException
Base exception class for all service exceptions from CloudControl service.