Report an issue
Back to plugin list
alicloud
Official

Alibaba Cloud

The Alibaba Cloud source plugin for CloudQuery extracts configuration from the Alibaba Cloud API and loads it into any supported CloudQuery destination

Publisher

cloudquery

Repositorygithub.com
Latest version

v4.1.2

Type

Source

Platforms
Date Published

Feb 20, 2024

Price

Free

Set up process


brew install cloudquery/tap/cloudquery

1. Download CLI and login

See installation options

2. Create source and destination configs

Plugin configuration

cloudquery sync alicloud.yml postgresql.yml

3. Run the sync

CloudQuery sync

Overview

Alibaba Cloud Source Plugin

The Alibaba Cloud source plugin for CloudQuery extracts configuration from the Alibaba Cloud (阿里云) API and loads it into any supported CloudQuery destination (e.g. PostgreSQL, BigQuery, Snowflake, and more).

Configuration

The following configuration syncs from Alibaba Cloud to a Postgres destination. The (top level) source spec section is described in the Source Spec Reference. The config for the postgresql destination is not shown here. See our Quickstart if you need help setting up the destination.
kind: source
spec:
  name: "alicloud"
  path: "cloudquery/alicloud"
  registry: "cloudquery"
  version: "v4.1.2"
  tables: ["*"]
  destinations: ["postgresql"]
  spec:
    accounts:
      - name: my_account
        regions:
        - cn-hangzhou
        - cn-beijing
        - eu-west-1
        - us-west-1
        # ...
        access_key: ${ALICLOUD_ACCESS_KEY}
        secret_key: ${ALICLOUD_SECRET_KEY}
    # Optional parameters
    # concurrency: 50000
    # bill_history_months: 12
  • concurrency (int, optional, default: 50000):
    A best effort maximum number of Go routines to use. Lower this number to reduce memory usage.
  • accounts (array[object], required):
    A list of accounts to sync. Every account must have a unique name, and must specify at least one region. The access_key and secret_key are required and can be specified as environment variables, as shown in the example above.
    • name (string, required): A unique name for the account.
    • regions (array[string], required): A list of regions to sync. For example, ["cn-hangzhou", "cn-beijing"].
    • access_key (string, required): A valid access key for the account
    • secret_key (string, required): A valid secret key for the account, corresponding to the access key
  • bill_history_months (int, optional):
    The number of months of billing history to fetch for the alicloud_bss_bill and alicloud_bss_bill_overview tables. Defaults to 12.
See the Alibaba documentation for how to obtain an AccessKey pair.

Authentication

Authentication is done via access keys. See Obtain an AccessKey pair for more information.
It is highly recommended that you use environment variable expansion to store your access key pair. For example, you can set the following environment variables:
  • ALICLOUD_ACCESS_KEY - The access key ID.
  • ALICLOUD_SECRET_KEY - The access key secret.
And then use them in the configuration as follows:
access_key: ${ALICLOUD_ACCESS_KEY}
secret_key: ${ALICLOUD_SECRET_KEY}

Example Queries

Find all ECS instances in a region

select
  instance_id,
  os_name,
  region_id,
  start_time,
  tags
from
  alicloud_ecs_instances
where
  region_id = 'eu-west-1';
+------------------------+--------------------------------------+-----------+-------------------+---------------+
| instance_id            | os_name                              | region_id | start_time        | tags          |
|------------------------+--------------------------------------+-----------+-------------------+---------------|
| i-xxxxxxxxxxxxxxxxxxxx | Alibaba Cloud Linux  3.2104 LTS 64位 | eu-west-1 | 2023-01-17T14:40Z | {"Tag": null} |
+------------------------+--------------------------------------+-----------+-------------------+---------------+

Query past bills

select
  product_name,
  item,
  pip_code,
  currency,
  adjust_amount
from
  alicloud_bss_bill_overview;
+------------------------+----------------+----------+----------+---------------+
| product_name           | item           | pip_code | currency | adjust_amount |
|------------------------+----------------+----------+----------+---------------|
| Object Storage Service | PayAsYouGoBill | oss      | USD      | 0.0           |
+------------------------+----------------+----------+----------+---------------+

Query bucket stats

select
  account_id,
  bucket_name,
  object_count,
  storage
from
  alicloud_oss_bucket_stats;
+------------+-------------+--------------+---------+
| account_id | bucket_name | object_count | storage |
|------------+-------------+--------------+---------|
| test       | cq-test     | 2            | 29665   |
+------------+-------------+--------------+---------+


Subscribe to product updates

Be the first to know about new features.