AWS Fundamentals Logo
AWS Fundamentals
L2 Construct

ApiKey

An API Gateway ApiKey. An ApiKey can be distributed to API clients that are connecting to WebSocket APIs that require API key authentication. The key is used to authenticate WebSocket connections and associate them with usage plans for throttling and quota management.

Import

import { ApiKey } from 'aws-cdk-lib/aws-apigatewayv2';

Or use the module namespace:

import * as apigatewayv2 from 'aws-cdk-lib/aws-apigatewayv2';
// apigatewayv2.ApiKey

Properties

Configuration passed to the constructor as ApiKeyProps.

customerIdOptional
string

An AWS Marketplace customer identifier to use when integrating with the AWS SaaS Marketplace.

Default: none

enabledOptional
boolean

Indicates whether the API key can be used by clients.

Default: true

generateDistinctIdOptional
boolean

Specifies whether the key identifier is distinct from the created API key value.

Default: false

3 properties inherited from ApiKeyOptions
apiKeyNameOptionalinherited from ApiKeyOptions
string

A name for the API key. If you don't specify a name, AWS CloudFormation generates a unique physical ID and uses that ID for the API key name.

Default: automatically generated name

descriptionOptionalinherited from ApiKeyOptions
string

A description of the purpose of the API key.

Default: none

valueOptionalinherited from ApiKeyOptions
string

The value of the API key. Must be at least 20 characters long.

Default: none

Learn AWS the Practical Way

Our bi-weekly newsletter teaches hands-on AWS fundamentals. No certification fluff - just practical knowledge.

Subscribe to Newsletter