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
IUserPool and IUserPoolClient interfaces 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
AWS CDK Library version (aws-cdk-lib)
2.221.0
AWS CDK CLI version
all
Environment details (OS name and version, etc.)
all
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:
Use Case
When use AgentCore Runtime with Cognito UserPool and UserPoolClient.
Proposed Solution
Modify
RuntimeAuthorizerConfiguration.usingCognito()to:IUserPoolandIUserPoolClientinterfaces instead of strings for better type safety and DXenv.regionProposed Implementation:
Other Information
No response
Acknowledgements
AWS CDK Library version (aws-cdk-lib)
2.221.0
AWS CDK CLI version
all
Environment details (OS name and version, etc.)
all