Authorizer
The Authorizer resource lets you manage AWS IoT Authorizers which are used to control access to AWS IoT devices and services.
Minimal Example
Section titled “Minimal Example”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"});
Advanced Configuration
Section titled “Advanced Configuration”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" }});
Using Tags for Resource Management
Section titled “Using Tags for Resource Management”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" } ]});
Adopting Existing Resources
Section titled “Adopting Existing Resources”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});