SecurityKey
The SecurityKey resource lets you manage AWS Connect SecurityKeys for secure access to your Amazon Connect instances.
Minimal Example
Section titled “Minimal Example”Create a basic SecurityKey with the required properties:
import AWS from "alchemy/aws/control";
const securityKey = await AWS.Connect.SecurityKey("default-security-key", { InstanceId: "instance-12345678", Key: "my-secure-key"});
Adoption of Existing Resource
Section titled “Adoption of Existing Resource”You can adopt an existing SecurityKey instead of failing when it already exists:
const existingSecurityKey = await AWS.Connect.SecurityKey("existing-security-key", { InstanceId: "instance-12345678", Key: "my-secure-key", adopt: true // This will adopt the existing SecurityKey if it exists});
Advanced Configuration
Section titled “Advanced Configuration”This example demonstrates how to access the ARN and timestamps of the created SecurityKey:
const securityKeyWithDetails = await AWS.Connect.SecurityKey("detailed-security-key", { InstanceId: "instance-12345678", Key: "my-secure-key"});
// Accessing additional propertiesconsole.log(`Security Key ARN: ${securityKeyWithDetails.Arn}`);console.log(`Created At: ${securityKeyWithDetails.CreationTime}`);console.log(`Last Updated At: ${securityKeyWithDetails.LastUpdateTime}`);
Use Case: Key Rotation
Section titled “Use Case: Key Rotation”In this example, we create a new SecurityKey for key rotation purposes:
const newSecurityKey = await AWS.Connect.SecurityKey("key-rotation-security-key", { InstanceId: "instance-12345678", Key: "my-new-secure-key"});
// Implement logic to update applications to use the new keyconsole.log(`New Security Key created: ${newSecurityKey.Arn}`);
Use Case: Multiple Security Keys
Section titled “Use Case: Multiple Security Keys”You can create multiple SecurityKeys for different purposes, such as development and production:
const devSecurityKey = await AWS.Connect.SecurityKey("dev-security-key", { InstanceId: "instance-12345678", Key: "dev-secure-key"});
const prodSecurityKey = await AWS.Connect.SecurityKey("prod-security-key", { InstanceId: "instance-12345678", Key: "prod-secure-key"});
// Log the ARNs for both SecurityKeysconsole.log(`Development Security Key ARN: ${devSecurityKey.Arn}`);console.log(`Production Security Key ARN: ${prodSecurityKey.Arn}`);