-
Notifications
You must be signed in to change notification settings - Fork 4.5k
bedrock-agentcore: use IUserPool and IUserPoolClient interfaces instead of string identifiers #35854
Copy link
Copy link
Closed
Labels
@aws-cdk/aws-cognitoRelated to Amazon CognitoRelated to Amazon Cognitoeffort/mediumMedium work item – several days of effortMedium work item – several days of effortfeature-requestA feature should be added or improved.A feature should be added or improved.p2
Description
Describe the feature
The current RuntimeAuthorizerConfiguration.usingCognito() method in agentcore requires string identifiers (User Pool ID and Client ID) to be passed as parameters.
AWS CDK best practices emphasize passing construct interfaces rather than string identifiers, which provides better type safety and a more intuitive developer experience.
Additionally, the region parameter is redundant since it can be automatically derived from the stack's environment (env.region).
Current Implementation:
authorizerConfiguration: agentcore.RuntimeAuthorizerConfiguration.usingCognito(
"us-west-2_ABC123", // User Pool ID (string)
"client123", // Client ID (string)
"us-west-2" // Region (optional, string) - redundant!
)Use Case
When use AgentCore Runtime with Cognito UserPool and UserPoolClient.
Proposed Solution
Modify RuntimeAuthorizerConfiguration.usingCognito() to:
- Accept
IUserPoolandIUserPoolClientinterfaces instead of strings for better type safety and DX - Remove the region parameter entirely and automatically use the stack's
env.region
Proposed Implementation:
import * as cognito from 'aws-cdk-lib/aws-cognito';
declare const userPool: new cognito.UserPool;
declare const userPoolClient: cognito.UserPoolClient;
const runtime = new agentcore.Runtime(this, "MyAgentRuntime", {
runtimeName: "myAgent",
agentRuntimeArtifact: agentRuntimeArtifact,
authorizerConfiguration: agentcore.RuntimeAuthorizerConfiguration.usingCognito(
userPool, // IUserPool interface
userClient // IUserPoolClient interface
// region automatically resolved from stack.env.region
),
});Other Information
No response
Acknowledgements
- I may be able to implement this feature request
- This feature might incur a breaking change
AWS CDK Library version (aws-cdk-lib)
2.221.0
AWS CDK CLI version
all
Environment details (OS name and version, etc.)
all
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
@aws-cdk/aws-cognitoRelated to Amazon CognitoRelated to Amazon Cognitoeffort/mediumMedium work item – several days of effortMedium work item – several days of effortfeature-requestA feature should be added or improved.A feature should be added or improved.p2