All Products
Search
Document Center

Simple Log Service:List projects

Last Updated:Sep 16, 2026

Lists all projects in a specified resource group in the current region.

Prerequisites

Parameter description

 def list_project(self, offset=0, size=100, project_name_pattern=None, resource_group_id=''):

Request parameters

Parameter

Type

Required

Description

offset

integer

No

The line from which the query starts. Default value: 0.

size

integer

No

The number of entries per page. Default value: 100. Maximum: 500.

project_name_pattern

string

No

The project name used for fuzzy matching. For example, if you specify aliyun-project, the results include projects such as aliyun-project-sls and hangzhou-aliyun-project.

  • If not specified, all projects in the region are returned.

  • If specified, only projects whose names match the fuzzy search term are returned.

resource_group_id

string

No

Resource group ID. If not specified, the default resource group is used. 

Response parameters

For more information about the response parameters, see ListProject.

Sample code

from aliyun.log import LogClient
import os

# In this example, the AccessKey ID and AccessKey secret are obtained from environment variables.
access_key_id = os.environ.get('ALIBABA_CLOUD_ACCESS_KEY_ID', '')
access_key_secret = os.environ.get('ALIBABA_CLOUD_ACCESS_KEY_SECRET', '')

# The Simple Log Service endpoint.
endpoint = "cn-hangzhou.log.aliyuncs.com"
# Create a Simple Log Service client.
client = LogClient(endpoint, access_key_id, access_key_secret)


# List projects in the default resource group in the current region.
def main():
    try:
        response = client.list_project()
        response.log_print()
    except Exception as error:
        print(error)


if __name__ == '__main__':
    main()