aws-cdk icon indicating copy to clipboard operation
aws-cdk copied to clipboard

(aws-bedrock-agentcore-alpha): Make physical name properties optional for all resources

Open mazyu36 opened this issue 2 weeks ago • 1 comments

Describe the feature

All AWS Bedrock AgentCore constructs currently require physical name properties to be specified. These should be made optional, allowing CDK to automatically generate unique physical names when not specified, following AWS CDK best practices.

According to the AWS CDK Best Practices guide:

"Use generated resource names, not physical names"

Use Case

Making physical names optional provides several benefits:

  1. Stack reusability: Required physical names make it difficult to deploy the same stack across multiple environments (dev, staging, production) without code changes.

  2. Avoid naming conflicts: Auto-generated names guarantee uniqueness across stacks and environments.

Proposed Solution

Make physical name properties optional in all AgentCore resource Props interfaces and auto-generate names using Names.uniqueResourceName() when not specified.

Other Information

No response

Acknowledgements

  • [x] I may be able to implement this feature request
  • [ ] This feature might incur a breaking change

AWS CDK Library version (aws-cdk-lib)

all

AWS CDK CLI version

all

Environment details (OS name and version, etc.)

all

mazyu36 avatar Dec 09 '25 11:12 mazyu36

Hi @mazyu36,

Thank you for this excellent feature request and for already submitting PR #36354! This is a valuable improvement that aligns the Bedrock AgentCore constructs with AWS CDK best practices.

Your analysis is spot-on - making physical names optional provides significant benefits:

  • Stack reusability across environments without code changes
  • Automatic uniqueness guarantees via CDK's name generation
  • Best practice alignment with the CDK guidance on generated resource names

I've reviewed your PR implementation and the approach looks solid:

  1. ✅ Props interfaces updated to make physical names optional
  2. ✅ Proper use of ResourceProps with physicalName in base class constructors
  3. ✅ Auto-generation using Names.uniqueResourceName() with appropriate maxLength constraints
  4. ✅ Comprehensive test coverage for all affected resources
  5. ✅ README documentation updates

The implementation correctly handles all seven AgentCore resource types:

This change is backward compatible since existing code with explicit names will continue to work. Once the PR description is completed and tests pass, this should be ready for review by the CDK team.

Great contribution! 🎉

pahud avatar Dec 10 '25 19:12 pahud