class ApiKeyCredentialLocation
| Language | Type name |
|---|---|
.NET | Amazon.CDK.AWS.Bedrock.Agentcore.Alpha.ApiKeyCredentialLocation |
Go | github.com/aws/aws-cdk-go/awsbedrockagentcorealpha/v2#ApiKeyCredentialLocation |
Java | software.amazon.awscdk.services.bedrock.agentcore.alpha.ApiKeyCredentialLocation |
Python | aws_cdk.aws_bedrock_agentcore_alpha.ApiKeyCredentialLocation |
TypeScript (source) | @aws-cdk/aws-bedrock-agentcore-alpha ยป ApiKeyCredentialLocation |
API Key location within the request.
Example
const gateway = new agentcore.Gateway(this, "MyGateway", {
gatewayName: "my-gateway",
});
// These ARNs are returned when creating the API key credential provider via Console or API
const apiKeyProviderArn = "arn:aws:bedrock-agentcore:us-east-1:123456789012:token-vault/abc123/apikeycredentialprovider/my-apikey"
const apiKeySecretArn = "arn:aws:secretsmanager:us-east-1:123456789012:secret:my-apikey-secret-abc123"
const bucket = s3.Bucket.fromBucketName(this, "ExistingBucket", "my-schema-bucket");
const s3mySchema = agentcore.ApiSchema.fromS3File(bucket, "schemas/myschema.yaml");
// Add an OpenAPI target directly to the gateway
const target = gateway.addOpenApiTarget("MyTarget", {
gatewayTargetName: "my-api-target",
description: "Target for external API integration",
apiSchema: s3mySchema,
credentialProviderConfigurations: [
agentcore.GatewayCredentialProvider.fromApiKeyIdentityArn({
providerArn: apiKeyProviderArn,
secretArn: apiKeySecretArn,
credentialLocation: agentcore.ApiKeyCredentialLocation.header({
credentialParameterName: "X-API-Key",
}),
}),
],
});
// This make 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 (