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

Research on integration Public Cloud Project Cost Display for AWS and Azure #3800

Open
junminahn opened this issue Sep 18, 2024 · 1 comment
Assignees

Comments

@junminahn
Copy link
Collaborator

junminahn commented Sep 18, 2024

Description

Display project costs on Registry app for public cloud projects by pulling total expenses for each namespace from AWS and Azure APIs. Include a link to the detailed cost dashboard in AWS/Azure for further information.

Technical Details

  • Collaborate with the public cloud team to obtain read-only access to the API endpoints.
  • Research AWS and Azure API endpoints to pull the current billing data.
  • Explore both:
    • AWS
    • Azure
  • Confirm whether expense data is accessible via these API endpoints and investigate tools (packages) provided by AWS and Azure to simplify API usage.
  • Check the characteristics of access tokens, such as expiration dates and fine-grained access control, to ensure minimum privilege for the registry app.

Definition of Done (DOD)

  • Write a basic script to pull expense data from AWS and Azure as a comment of this ticket.
@junminahn junminahn changed the title Public Cloud total expense information Integrate Public Cloud Project Cost Display for AWS and Azure Sep 18, 2024
@junminahn junminahn changed the title Integrate Public Cloud Project Cost Display for AWS and Azure Research on integration Public Cloud Project Cost Display for AWS and Azure Sep 18, 2024
@Kolezhanchik
Copy link
Collaborator

After a conversation with Prabhu, the task was put on hold. It was determined that creating a user role for retrieving budget/cost data is not possible due to security concerns. The public cloud team will explore a solution to provide the app-dev team with the necessary credentials at a later time.

import { BudgetsClient, DescribeBudgetCommand } from '@aws-sdk/client-budgets';
import AWS from 'aws-sdk';

const AWS_ACCESS_KEY_ID = '';
const AWS_SECRET_ACCESS_KEY = '';
const AWS_REGION = '';

// https://www.npmjs.com/package/@aws-sdk/client-budgets
const client = new BudgetsClient({
  credentials: {
    accessKeyId: AWS_ACCESS_KEY_ID,
    secretAccessKey: AWS_SECRET_ACCESS_KEY,
  },
  region: AWS_REGION,
});

async function describeBudget() {
  const params = {
    AccountId: 'aws-account-id',
    BudgetName: 'budget-name',
  };

  try {
    const command = new DescribeBudgetCommand(params);
    // expected output https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-budgets/Interface/DescribeBudgetCommandOutput/
    const response = await client.send(command);
    console.log('Budget:', response.Budget);
  } catch (error) {
    console.error('Error fetching budget:', error);
  }
}

describeBudget();

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

No branches or pull requests

2 participants