Skip to content

Conversation

@kimsbrian
Copy link

Issue # (if applicable)

N/A

Reason for this change

Users currently need ECR repository constructs (fromEcrRepository) or local Docker assets (fromAsset) to reference container images in AgentCore runtimes. This creates friction when:

  • Container URIs come from CloudFormation parameters or stack outputs
  • Referencing images in external registries (Docker Hub, private registries)
  • Working with cross-stack or cross-account image references

Description of changes

Added fromImageUri() static method to AgentRuntimeArtifact class:

  • Created ImageUriArtifact class extending AgentRuntimeArtifact
  • Accepts container URI as a string (supports CloudFormation tokens/expressions)
  • No automatic IAM permissions granted (user manages permissions separately)
  • Follows existing patterns from EcrImage and AssetImage classes

This provides a fourth deployment option alongside fromEcrRepository(), fromAsset(), and fromS3().

Description of how you validated changes

Unit tests added:

  • Basic URI reference test
  • CloudFormation token support test
  • Verification that no permissions are required

Manual testing:
bash
cd packages/@aws-cdk/aws-bedrock-agentcore-alpha
yarn build
yarn test

All tests pass.

Production usage:
This change has been built locally and used successfully in my application to reference container images via CloudFormation parameters.

Checklist


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@aws-cdk-automation aws-cdk-automation requested a review from a team December 1, 2025 18:23
@github-actions github-actions bot added p2 beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK labels Dec 1, 2025
Copy link
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pull request linter fails with the following errors:

❌ Features must contain a change to an integration test file and the resulting snapshot.

If you believe this pull request should receive an exemption, please comment and provide a justification. A comment requesting an exemption should contain the text Exemption Request. Additionally, if clarification is needed, add Clarification Request to a comment.

✅ A exemption request has been requested. Please wait for a maintainer's review.

@kimsbrian
Copy link
Author

Exemption Request

This doesn't need an integration test. It's adding another way to pass a container URI to the same CloudFormation property that fromEcrRepository() and fromAsset() already use.

The method is a simple pass-through. It takes a string and sets containerUri. No new CloudFormation resources, no cross-service configuration, just an alternative to the existing methods.

Unit tests cover the behavior (URI reference, CloudFormation tokens, no auto-permissions).

@aws-cdk-automation aws-cdk-automation added the pr-linter/exemption-requested The contributor has requested an exemption to the PR Linter feedback. label Dec 1, 2025
@alvazjor alvazjor self-assigned this Dec 2, 2025
@aws-cdk-automation aws-cdk-automation added the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Dec 2, 2025
}

/**
* Reference an image using a container URI
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets add here documentation for the permissions limitation. Something like:

Use this method when you have a pre-existing image URI from CloudFormation parameters, cross-stack references, or external registries.
 
Note: No IAM permissions are automatically granted. You must ensure the runtime has appropriate permissions to pull from the registry.

super();
}

public bind(_scope: Construct, _runtime: Runtime): void {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a small coment here stating why this will be empty


class ImageUriArtifact extends AgentRuntimeArtifact {
constructor(private readonly containerUri: string) {
super();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A validation here for the containerUri is needed. CFN requires a string format, feel free to reuse it: https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-properties-bedrockagentcore-runtime-containerconfiguration.html

@kimsbrian
Copy link
Author

@alvazjor Thanks for the feedback. Reading the container uri pattern requirement shows it only accepts ECR which means that external repos unfortunately can't be used. Maybe it's worthwhile to eventually enable this from the Bedrock agentcore side. At least for my use case, I'm still happy to have this change in. Updated the documentation and comments to reflect ECR only containers are supported.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK p2 pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. pr-linter/exemption-requested The contributor has requested an exemption to the PR Linter feedback.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants