CreatePackageVersionCommand

Creates a new version for an existing IoT software package.

Requires permission to access the CreatePackageVersion  and GetIndexingConfiguration  actions.

Example Syntax

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

import { IoTClient, CreatePackageVersionCommand } from "@aws-sdk/client-iot"; // ES Modules import
// const { IoTClient, CreatePackageVersionCommand } = require("@aws-sdk/client-iot"); // CommonJS import
const client = new IoTClient(config);
const input = { // CreatePackageVersionRequest
  packageName: "STRING_VALUE", // required
  versionName: "STRING_VALUE", // required
  description: "STRING_VALUE",
  attributes: { // ResourceAttributes
    "<keys>": "STRING_VALUE",
  },
  artifact: { // PackageVersionArtifact
    s3Location: { // S3Location
      bucket: "STRING_VALUE",
      key: "STRING_VALUE",
      version: "STRING_VALUE",
    },
  },
  recipe: "STRING_VALUE",
  tags: { // TagMap
    "<keys>": "STRING_VALUE",
  },
  clientToken: "STRING_VALUE",
};
const command = new CreatePackageVersionCommand(input);
const response = await client.send(command);
// { // CreatePackageVersionResponse
//   packageVersionArn: "STRING_VALUE",
//   packageName: "STRING_VALUE",
//   versionName: "STRING_VALUE",
//   description: "STRING_VALUE",
//   attributes: { // ResourceAttributes
//     "<keys>": "STRING_VALUE",
//   },
//   status: "DRAFT" || "PUBLISHED" || "DEPRECATED",
//   errorReason: "STRING_VALUE",
// };

CreatePackageVersionCommand Input

Parameter
Type
Description
packageName
Required
string | undefined

The name of the associated software package.

versionName
Required
string | undefined

The name of the new package version.

artifact
PackageVersionArtifact | undefined

The various build components created during the build process such as libraries and configuration files that make up a software package version.

attributes
Record<string, string> | undefined

Metadata that can be used to define a package version’s configuration. For example, the S3 file location, configuration options that are being sent to the device or fleet.

The combined size of all the attributes on a package version is limited to 3KB.

clientToken
string | undefined

A unique case-sensitive identifier that you can provide to ensure the idempotency of the request. Don't reuse this client token if a new idempotent request is required.

description
string | undefined

A summary of the package version being created. This can be used to outline the package's contents or purpose.

recipe
string | undefined

The inline job document associated with a software package version used for a quick job deployment.

tags
Record<string, string> | undefined

Metadata that can be used to manage the package version.

CreatePackageVersionCommand Output

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
attributes
Record<string, string> | undefined

Metadata that were added to the package version that can be used to define a package version’s configuration.

description
string | undefined

The package version description.

errorReason
string | undefined

Error reason for a package version failure during creation or update.

packageName
string | undefined

The name of the associated software package.

packageVersionArn
string | undefined

The Amazon Resource Name (ARN) for the package.

status
PackageVersionStatus | undefined

The status of the package version. For more information, see Package version lifecycle .

versionName
string | undefined

The name of the new package version.

Throws

Name
Fault
Details
ConflictException
client

The request conflicts with the current state of the resource.

InternalServerException
server

Internal error from the service that indicates an unexpected error or that the service is unavailable.

ServiceQuotaExceededException
client

Service quota has been exceeded.

ThrottlingException
client

The rate exceeds the limit.

ValidationException
client

The request is not valid.

IoTServiceException
Base exception class for all service exceptions from IoT service.