Skip to content
GitHubXDiscord

Authorizer

The Authorizer resource lets you manage AWS IoT Authorizers which are used to control access to AWS IoT devices and services.

Create an IoT Authorizer with the required properties and some common optional settings.

import AWS from "alchemy/aws/control";
const myAuthorizer = await AWS.IoT.Authorizer("myAuthorizer", {
AuthorizerFunctionArn: "arn:aws:lambda:us-west-2:123456789012:function:myAuthFunction",
Status: "ACTIVE",
TokenKeyName: "Authorization"
});

Configure an IoT Authorizer with additional settings such as caching and token signing.

const advancedAuthorizer = await AWS.IoT.Authorizer("advancedAuthorizer", {
AuthorizerFunctionArn: "arn:aws:lambda:us-west-2:123456789012:function:advancedAuthFunction",
Status: "ACTIVE",
TokenKeyName: "Authorization",
EnableCachingForHttp: true,
SigningDisabled: false,
TokenSigningPublicKeys: {
"key1": "publicKeyData"
}
});

You can add tags to your Authorizer for better resource management and organization.

const taggedAuthorizer = await AWS.IoT.Authorizer("taggedAuthorizer", {
AuthorizerFunctionArn: "arn:aws:lambda:us-west-2:123456789012:function:taggedAuthFunction",
Status: "ACTIVE",
Tags: [
{ Key: "Environment", Value: "Production" },
{ Key: "Project", Value: "IoTPlatform" }
]
});

If you want to adopt an existing Authorizer instead of failing if it already exists, set the adopt parameter to true.

const adoptedAuthorizer = await AWS.IoT.Authorizer("existingAuthorizer", {
AuthorizerFunctionArn: "arn:aws:lambda:us-west-2:123456789012:function:existingAuthFunction",
Status: "ACTIVE",
adopt: true
});