APIKey
The APIKey resource allows you to manage AWS Location APIKeys, which are used to authenticate requests made to the AWS Location Service.
Minimal Example
Section titled “Minimal Example”Create a basic APIKey with required properties and a common optional property.
import AWS from "alchemy/aws/control";
const basicApiKey = await AWS.Location.APIKey("basicApiKey", { KeyName: "MyLocationApiKey", Description: "API Key for accessing AWS Location Service", Restrictions: { // Define restrictions as necessary // For demonstration purposes, we'll leave this empty }, Tags: [ { Key: "Project", Value: "LocationService" } ]});
Advanced Configuration
Section titled “Advanced Configuration”Configure an APIKey with no expiry and forced updates.
const advancedApiKey = await AWS.Location.APIKey("advancedApiKey", { KeyName: "AdvancedLocationApiKey", Description: "Advanced API Key with no expiry and forced update", NoExpiry: true, ForceUpdate: true, Restrictions: { // Add specific restrictions as necessary }, Tags: [ { Key: "Environment", Value: "Production" }, { Key: "Team", Value: "GeoServices" } ]});
Force Deletion Example
Section titled “Force Deletion Example”Create an APIKey with the option to force delete.
const forceDeleteApiKey = await AWS.Location.APIKey("forceDeleteApiKey", { KeyName: "ForceDeleteApiKey", Description: "API Key that can be force deleted", ForceDelete: true, Restrictions: { // Define restrictions as necessary }});
Expiration Example
Section titled “Expiration Example”Create an APIKey with a specific expiration time.
const expirationApiKey = await AWS.Location.APIKey("expirationApiKey", { KeyName: "ExpirationLocationApiKey", Description: "API Key that expires after a set time", ExpireTime: new Date(Date.now() + 365 * 24 * 60 * 60 * 1000).toISOString(), // 1 year from now Restrictions: { // Add any necessary restrictions }});