aws-samples / aws-genai-llm-chatbot

A modular and comprehensive solution to deploy a Multi-LLM and Multi-RAG powered chatbot (Amazon Bedrock, Anthropic, HuggingFace, OpenAI, Meta, AI21, Cohere, Mistral) using AWS CDK on AWS
https://aws-samples.github.io/aws-genai-llm-chatbot/
MIT No Attribution
1.1k stars 332 forks source link

Tag separate deployments to track all resource costs in individual deployments under same account #602

Open nkay28 opened 2 weeks ago

nkay28 commented 2 weeks ago

Hi, Is there a current functionality to tag separate deployments of this tool/POC in order to track all/each resource costs associated with one deployment individually, under the same account? I tried to use the CloudFormation default tagging options by activating them in my account. Not sure how to connect them to my existing deployment. I think I have to add it in the Cloud Formation template and make a new deployment with that change, as per the AWS best practices? Could this be a feature addition to the base repo? A tagging question under the step 5, 'npm run config' step?
One work around would be to have different deployments in different regions and filter the cost with that, from what I understand? Though not really scalable.

Thank you

charles-marion commented 2 weeks ago

Hi @nkay28 ,

CDK makes it easy to add Tags in bulk, see here: https://docs.aws.amazon.com/cdk/v2/guide/tagging.html#tagging-use If the scope is the stack for example it should add the tag to itself and all its children.

You could try to add here (I have not tested this change) https://github.com/aws-samples/aws-genai-llm-chatbot/blob/main/lib/aws-genai-llm-chatbot-stack.ts#L35

Tags.of(this).add('Project', props.config.prefix);

Note some resources would not be covered here. For example Bedrock on demand usage is not a Cloudformation resource and would not have a tag.

A possible option to isolate these different instances is to use multiple accounts: https://docs.aws.amazon.com/whitepapers/latest/organizing-your-aws-environment/organizing-your-aws-environment.html

nkay28 commented 3 days ago

I was able to separate out the CF deployment in billing using the prefix option at deployment. Thanks for the suggestions. I will try them out as I get into further weeds. For my use cases, I would want to keep them in the same account, for now at least.