Skip to content

Add tag for cost management #1167

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open

Add tag for cost management #1167

wants to merge 14 commits into from

Conversation

kazuhitogo
Copy link
Collaborator

@kazuhitogo kazuhitogo commented Jul 2, 2025

Description of Changes

Apply an Application Inference Profile to Bedrock models to tag model inferences.
Also apply tags to the entire CDK asset

Checklist

  • Modified relevant documentation
  • Verified operation in local environment
  • Executed npm run cdk:test and if there are snapshot differences, execute npm run cdk:test:update-snapshot to update snapshots
  • Check whether updates from a tag-free environment will result in breaking changes. If they would cause breaking changes, make them optional.
    • It's breaking change so optional if available knwoledgebase
  • Check if cost management is possible

Related Issues

#702 #650

@@ -6,4 +6,7 @@ import { createStacks } from '../lib/create-stacks';

const app = new cdk.App();
const params = getParams(app);
if (params.tag?.key && params.tag?.value) {
cdk.Tags.of(app).add(params.tag.key, params.tag.value);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

KnowledgeBase を有効化していた場合にタグを新たにつけると破壊的変更になってしまうため、タグ無しの場合はタグをつけないように修正

// NOTE: InvokeModelWithBidirectionalStreamCommand currently does not support Inference Profile Arn.
// When AWS adds support, uncomment the code block below and change 'const' to 'let' for modelIdOrArn.

const modelIdOrArn = event.model.modelId; // Fallback to modelId for now
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

InvokeModelWithBidirectionalStreamCommand が Inference Profile Arn (タグ) は対応していないが将来的な対応及び他との実装に合わせるため

for (const modelId of modelIds) {
// Inference Profile is not supported Cross Region Inference
if (
modelId.region === currentRegion &&
Copy link
Collaborator Author

@kazuhitogo kazuhitogo Jul 6, 2025

Choose a reason for hiding this comment

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

cross region inference は inference profile を2025/7/6 時点作成できないため

@kazuhitogo kazuhitogo changed the title [WIP] Add tag for cost management Add tag for cost management Jul 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant