class ApiKeyCredentialLocation
| Language | Type name |
|---|---|
.NET | Amazon.CDK.AWS.BedrockAgentCore.ApiKeyCredentialLocation |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awsbedrockagentcore#ApiKeyCredentialLocation |
Java | software.amazon.awscdk.services.bedrockagentcore.ApiKeyCredentialLocation |
Python | aws_cdk.aws_bedrockagentcore.ApiKeyCredentialLocation |
TypeScript (source) | aws-cdk-lib » aws_bedrockagentcore » ApiKeyCredentialLocation |
API Key location within the request.
Example
const gateway = new agentcore.Gateway(this, "MyGateway", {
gatewayName: "my-gateway",
});
// Create an API key credential provider in Token Vault
const apiKeyProvider = new agentcore.ApiKeyCredentialProvider(this, "MyApiKeyProvider", {
apiKeyCredentialProviderName: "my-apikey",
});
const bucket = s3.Bucket.fromBucketName(this, "ExistingBucket", "my-schema-bucket");
const s3mySchema = agentcore.ApiSchema.fromS3File(bucket, "schemas/myschema.yaml");
// Add an OpenAPI target using the L2 construct directly
const target = gateway.addOpenApiTarget("MyTarget", {
gatewayTargetName: "my-api-target",
description: "Target for external API integration",
apiSchema: s3mySchema,
credentialProviderConfigurations: [
agentcore.GatewayCredentialProvider.fromApiKeyIdentity(apiKeyProvider, {
credentialLocation: agentcore.ApiKeyCredentialLocation.header({
credentialParameterName: "X-API-Key",
}),
}),
],
});
// This makes sure your s3 bucket is available before target
target.node.addDependency(bucket);
Properties
| Name | Type | Description |
|---|---|---|
| credential | string | The type of credential location (HEADER or QUERY_PARAMETER). |
| credential | string | The name of the credential parameter. |
| credential | string | The prefix for the credential value. |
credentialLocationType
Type:
string
The type of credential location (HEADER or QUERY_PARAMETER).
credentialParameterName
Type:
string
The name of the credential parameter.
credentialPrefix?
Type:
string
(optional)
The prefix for the credential value.
Methods
| Name | Description |
|---|---|
| static header(config?) | Create a header-based API key credential location. |
| static query | Create a query parameter-based API key credential location. |
static header(config?)
public static header(config?: ApiKeyAdditionalConfiguration): ApiKeyCredentialLocation
Parameters
- config
Api— - Optional configuration for the credential location.Key Additional Configuration
Returns
Create a header-based API key credential location.
static queryParameter(config?)
public static queryParameter(config?: ApiKeyAdditionalConfiguration): ApiKeyCredentialLocation
Parameters
- config
Api— - Optional configuration for the credential location.Key Additional Configuration
Returns
Create a query parameter-based API key credential location.

.NET
Go
Java
Python
TypeScript (