Onboard Alibaba Cloud accounts with a Python script

You can use a custom Python script (onboard.py) to programmatically create and configure Alibaba Cloud resources required for Rapid7 to collect data from your environment. The script automates RAM user creation, policy configuration, and permission assignments.

Prerequisites

CLI and software:

  • Python 3.10 or greater
  • Alibaba Cloud CLI installed and configured (aliyun command available in your terminal)

General:

  • Appropriate Alibaba Cloud permissions:
    • RAM admin permissions or equivalent (required to create RAM users, policies, and AccessKeys)
  • Access to one or more Alibaba Cloud accounts
  • Cloud Security Domain or Organization Admin permissions
  • Cloud Security administrative permissions
Not sure if you have the correct Alibaba Cloud permissions?

You can use the script to check your Alibaba Cloud permissions. Review Common script use cases for details.

Key script terminology

Before you begin, review the core concepts used in Alibaba Cloud onboarding:

  • RAM User: A Resource Access Management (RAM) user is an identity within your Alibaba Cloud account used to represent a non-human principal that needs programmatic access to Alibaba Cloud APIs. The script creates a dedicated RAM user for Rapid7 data collection.
  • AccessKey: RAM users authenticate via an AccessKey ID and AccessKey Secret pair. The script generates these credentials automatically and presents them at the end of deployment. The AccessKey Secret is only displayed once and cannot be retrieved later.
  • RAM Policy: A RAM policy defines the set of permissions granted to a RAM user. The script creates a custom read-only policy (Rapid7CloudSecPolicy) scoped to the account level.
  • Policy Assignment Scope: All policies are applied at the account level to enable comprehensive resource visibility across the account.

Download the script and connect accounts

You can download the script in the Cloud Security Add Cloud Account interface.

Script reference

The onboarding script includes multiple options to customize or validate deployments. Use the help flag for the most up-to-date options:

python onboard.py --help
Many script options are pre-configured

Some options (like --user-name) may be pre-configured using environment variables (CHOSEN_ parameters) when generated from the platform.

Common script use cases

The most common use cases for the script (excluding onboarding) are as follows:

Troubleshooting