DEV Community

Choonho Son
Choonho Son

Posted on

[Cloudforet] Enable AWS Billing Plugin

Cloudforet Cost Explorer

Cloudforet can provide Cloud Billing information such as AWS, Azure, and GCP.

To enable the Cost Explorer, you need to execute CLI command.

Sorry, we didn't have frontend page for enable Cost Analysis API call.

Enable CLI tool, spacectl

To enable this feature, you have to understand spacectl CLI tool.

See how to enable spacectl. https://github.com/orgs/cloudforet-io/discussions/139

Eanble Cost Explorer (AWS Billing Plugin)

Overall process consists of 4 steps.

  1. access to spacectl POD
  2. Register AWS Billing DataSource Plugin
  3. Enable AWS Billing DataSource Plugin
  4. Sync AWS Billing DataSource Plugin

1. access to spacectl POD

The postfix of spacectl POD name is different from environment.

kubectl get pod -n spaceone


repository-667d88c474-8rzvh                1/1     Running     0          46h
secret-7944cdb66d-9qslg                    1/1     Running     0          46h
spacectl-c546c4d8c-ztlnr                   1/1     Running     0          46h
statistics-5585fb5848-4qxlm                1/1     Running     0          46h
statistics-scheduler-85cb8c5b9f-26mq8      1/1     Running     0          46h

kubectl exec -ti spacectl-c546c4d8c-ztlnr /bin/bash -n spaceone

Enter fullscreen mode Exit fullscreen mode

2 Register AWS Billing DataSource Plugin

We assume that you have configured spacectl API token already.

Create aws_data_source.yaml

---
name: AWS Cost Explorer Data Source
data_source_type: EXTERNAL
provider: aws
secret_type: USE_SERVICE_ACCOUNT_SECRET
plugin_info:
  plugin_id: plugin-aws-cost-explorer-cost-datasource
Enter fullscreen mode Exit fullscreen mode

To register DataSource

The command is

spacectl exec register cost_analysis.DataSource -f aws_data_source.yaml
Enter fullscreen mode Exit fullscreen mode

It may take quite long time to deploy AWS Billing plugin. may be 5~10 minutes.

After register plugin, you can find data_source_id in your response.

You can also find the data_source_id like

spacectl list cost_analysis.DataSource -c data_source_id,name
Enter fullscreen mode Exit fullscreen mode

3. Enable DataSource

After register AWS Billing Plugin, you have to enable DataSource.

spacectl exec enable cost_analysis.DataSource -p data_source_id=<Data Source ID>
Enter fullscreen mode Exit fullscreen mode

After enable DataSource, you can find Cost Explorer menu in web browser has changed.

This step is just enable plugin and register daily sync-up scheduler.

4. Sync DataSource

To see the real data right now, sync data manually.

spacectl exec sync cost_analysis.DataSource -p data_source_id=<Data Source ID>
Enter fullscreen mode Exit fullscreen mode

Enjoy Cost Explorer

Image description

If you have any question, please visit Cloudforet Discord channel. https://discord.gg/7ExpTmA6TE

References

AWS cost explorer plugin

https://github.com/cloudforet-io/plugin-aws-cost-explorer-cost-datasource

Top comments (0)