Skip to content
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

📊Tracking: AWS CE #8635

Open
SomayaB opened this issue Jun 18, 2020 · 2 comments
Open

📊Tracking: AWS CE #8635

SomayaB opened this issue Jun 18, 2020 · 2 comments
Labels
@aws-cdk/aws-ce Related to AWS Cost Explorer management/tracking Issues that track a subject or multiple issues needs-design This feature request needs additional design work. p2

Comments

@SomayaB
Copy link
Contributor

SomayaB commented Jun 18, 2020

Add your +1 👍 to help us prioritize high-level constructs for this service

Overview:

AWS Docs

Maturity: CloudFormation Resources Only

See the AWS Construct Library Module Lifecycle doc for more information about maturity levels.

Implementation:

See the CDK API Reference for more implementation details.

Issue list:


This is a 📊Tracking Issue

@SomayaB SomayaB added management/tracking Issues that track a subject or multiple issues @aws-cdk/aws-ce Related to AWS Cost Explorer needs-design This feature request needs additional design work. labels Jun 18, 2020
@MrArnoldPalmer MrArnoldPalmer removed their assignment Jun 21, 2021
@seanWLawrence
Copy link

seanWLawrence commented Jan 27, 2022

Hey team, even though there are only a few thumbs up, I'd like to take this on if that's alright!

If so, I'll start on the modeling/README file. So far I was thinking something like the following as an idea for the cost category, based on the feedback from #16564.

    const sharedBusinessUnit = CostCategoryRule.regular({
      value: "Shared",
      rule: Expression.dimension({
        key: DimensionValuesKey.LINKED_ACCOUNT,
        matchOptions: [MatchOption.EQUALS],
        values: ["222222222222"],
      }),
    });

    const businessUnit = new CostCategory(this, "BusinessUnit", {
      name: "Business Unit",
      defaultValue: "Other",
      ruleVersion: RuleVersion.COST_CATEGORY_EXPRESSION_V1,
      rules: [
        CostCategoryRule.inheritedValue({
          dimensionName: CostCategoryInheritedValueDimensionName.TAG,
          dimensionKey: "BusinessUnit",
        }),
        CostCategoryRule.regular({
          value: "Amazon.com",
          rule: Expression.dimension({
            key: DimensionValuesKey.LINKED_ACCOUNT,
            matchOptions: [MatchOption.EQUALS],
            values: ["11111111"],
          }),
        }),
        CostCategoryRule.regular({
          value: "Amazon Web Services",
          rule: Expression.tag({
            key: "Application",
            matchOptions: [MatchOption.CONTAINS, MatchOption.CASE_INSENSITIVE],
            values: ["AWS", "Amazon Web Services"],
          }),
        }),
        sharedBusinessUnit,
      ],
    });

    businessUnit.addSplitChargeRule(
      CostCategorySplitChargeRule.proportional({
        source: sharedBusinessUnit,
        targets: businessUnit.rules,
      })
    );

@seanWLawrence
Copy link

seanWLawrence commented Jan 27, 2022

I'm also thinking we can add a type to model the account numbers and other dimension values so we can add validation. For example: DimensionValue.awsAccount("11111111")) and DimensionValue.dimension("Shared") throw if the account number or string doesn't pass validation for correct length, etc. though I'm not sure if that's overkill. Here's how that could look:

    const sharedBusinessUnit = CostCategoryRule.regular({
      value: ExpressionValue.dimension("Shared"),
      rule: Expression.dimension({
        key: DimensionValuesKey.LINKED_ACCOUNT,
        matchOptions: [MatchOption.EQUALS],
        values: [ExpressionValue.awsAccount("222222222222")],
      }),
    });

    const businessUnit = new CostCategory(this, "BusinessUnit", {
      name: ExpressionValue.costCategory("Business Unit"),
      defaultValue: ExpressionValue.costCategory("Other"),
      ruleVersion: RuleVersion.COST_CATEGORY_EXPRESSION_V1,
      rules: [
        CostCategoryRule.inheritedValue({
          dimensionName: CostCategoryInheritedValueDimensionName.TAG,
          dimensionKey: ExpressionValue.costCategory("BusinessUnit"),
        }),
        CostCategoryRule.regular({
          value: ExpressionValue.costCategory("Amazon.com"),
          rule: Expression.dimension({
            key: DimensionValuesKey.LINKED_ACCOUNT,
            matchOptions: [MatchOption.EQUALS],
            values: [ExpressionValue.awsAccount("111111111111")],
          }),
        }),
        CostCategoryRule.regular({
          value: ExpressionValue.costCategory("Amazon Web Services"),
          rule: Expression.tag({
            key: ExpressionValue.dimension("Application"),
            matchOptions: [MatchOption.CONTAINS, MatchOption.CASE_INSENSITIVE],
            values: [
              ExpressionValue.dimension("AWS"),
              ExpressionValue.dimension("Amazon Web Services"),
            ],
          }),
        }),
        sharedBusinessUnit,
      ],
    });

    businessUnit.addSplitChargeRule(
      CostCategorySplitChargeRule.proportional({
        source: sharedBusinessUnit,
        targets: businessUnit.rules,
      })
    );

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-ce Related to AWS Cost Explorer management/tracking Issues that track a subject or multiple issues needs-design This feature request needs additional design work. p2
Projects
None yet
Development

No branches or pull requests

4 participants