copy_project

Updated at:

You can use the command-line interface (CLI) to copy resources from a source project to a destination project.

You can use this command to copy the following Simple Log Service configurations to another project:

  • Logstore

  • Index configurations

  • Logtail configurations

  • Machine groups

  • Associations between machine groups and Logtail configurations

For more information, see Examples.

Request syntax

aliyunlog log copy_project --from_project=<value> --to_project=<value> [--to_client=<value>] [--copy_machine_group=<value>] [--access-id=<value>] [--access-key=<value>] [--sts-token=<value>] [--region-endpoint=<value>] [--client-name=<value>] [--jmes-filter=<value>] [--format-output=<value>] [--decode-output=<value>]

Request parameters

The following table describes the required and command-specific parameters.

Parameter Name

Type

Required

Example

Description

--from_project

String

Yes

project-a

The name of the source project.

--to_project

String

Yes

project-b

The name of the destination project.

--to_client

String

No

test

The account that has the permissions to operate on the project. For more information about how to configure the account, see Configure the CLI.

--copy_machine_group

Boolean

No

false

Specifies whether to copy resources related to machine groups. Valid values:

  • true: Copies machine group resources to the destination project.

  • false (default): Does not copy the resources.

For information about the global parameters of the Simple Log Service CLI, see Global parameters.

Examples

  • Sample requests

    • Copy resources from project-a to project-b in the same region using the default account.

      aliyunlog log copy_project --from_project="project-a" --to_project="project-b"
    • Copy resources from project-a of the default account to project-b of the test account across regions.

      For example, you can copy a project from the China (Chengdu) region to the China (Hangzhou) region.

      1. Set up two users for the China (Hangzhou) and China (Chengdu) regions. For more information, see the configure command.

        • Set up the user for the China (Hangzhou) region.

          aliyunlog configure yourAccessKeyID yourAccessKeySecret cn-hangzhou.log.aliyuncs.com test
        • Set up the default user for the China (Chengdu) region.

          aliyunlog configure yourAccessKeyID yourAccessKeySecret cn-chengdu.log.aliyuncs.com
      2. Copy the project.

      aliyunlog log copy_project --from_project="project-a" --to_project="project-b" --to_client="test"  --client-name="main"
    • Copy resources, Logtail configurations, and resources related to machine groups from project-a of the default account to project-b of the test account across regions.

      aliyunlog log copy_project --from_project="project-a" --to_project="project-b" --copy_machine_group=true --to_client="test"  --client-name="main"
  • Sample response

    If the command is successful, no response is returned.