Skip to content
GitHubXDiscordRSS

Certificate

Learn how to create, update, and manage AWS IoT Certificates using Alchemy Cloud Control.

The Certificate resource allows you to manage AWS IoT Certificates used for secure communication with AWS IoT services.

Create a basic IoT certificate with the required status property and an optional CA certificate PEM.

import AWS from "alchemy/aws/control";
const iotCertificate = await AWS.IoT.Certificate("iotCertificate", {
Status: "ACTIVE",
CACertificatePem: "-----BEGIN CERTIFICATE-----\n...\n-----END CERTIFICATE-----"
});

Configure an IoT certificate with a certificate signing request and a specific certificate mode.

const advancedCertificate = await AWS.IoT.Certificate("advancedCertificate", {
Status: "ACTIVE",
CertificateSigningRequest: "-----BEGIN CERTIFICATE REQUEST-----\n...\n-----END CERTIFICATE REQUEST-----",
CertificateMode: "SNI_ONLY"
});

If you want to adopt an existing certificate instead of failing when it already exists, you can set the adopt property to true.

const existingCertificate = await AWS.IoT.Certificate("existingCertificate", {
Status: "ACTIVE",
adopt: true
});

You can also update an existing certificate’s status by referencing its ARN.

const updateCertificate = await AWS.IoT.Certificate("updateCertificate", {
Status: "INACTIVE",
Arn: "arn:aws:iot:us-west-2:123456789012:cert/abcd1234-efgh-5678-ijkl-mnopqrstuv"
});