Skip to main content

AWS CLI

AWS CLI (AWS Command Line Interface) is a command-line interface for working with AWS services that allows using Amazon CloudWatch API methods. For more information, see the DescribeLogGroups, DescribeLogStreams, GetLogEvents, and FilterLogEvents articles in the AWS documentation.

Using AWS CLI, you can work with logs: get events, event streams, and log groups.

Before you begin, configure AWS CLI.

Configure AWS CLI

  1. Add a service user.
  2. Issue an S3 key to the user.
  3. Install the client.
  4. Set up AWS CLI configuration.

1. Add a service user

Add a service user with the Projects scope permission and the role:

Users can be added by the Account Owner or users with the iam.admin role.

2. Issue an S3 key to the user

Only the Account Owner or a user with the iam.admin role can issue S3 keys to other users.

You need to create a separate key for each project. You can issue multiple keys for a single project.

  1. In the control panel, on the top menu, click IAM.

  2. Go to the Service users section.

  3. Open the user page → the Access tab.

  4. In the S3 keys block, click Add key.

  5. Enter the key name.

  6. Select the project that the key will apply to.

  7. Click Generate. Two values will be generated:

    • Access key — Access Key ID, the key identifier;
    • Secret key — Secret Access Key, the secret key.
  8. Click Copy and save the key — it cannot be viewed after the window is closed.

3. Install the client⁠​

Use the Install or update to the latest version of the AWS CLI guide in the Amazon documentation.

4. Configure AWS CLI settings⁠​

  1. Open the CLI.

  2. Open configuration mode:

    aws configure
  3. Enter the AWS Access Key ID — the value of the Access key field from the S3 key that you issued to the user, and press Enter.

  4. Enter the AWS Secret Access Key — the value of the Secret key field from the S3 key that you issued to the user, and press Enter.

  5. Enter the Default region name — the pool where the logs are located (for example, ru-9 ), and press Enter.

  6. Optional: enter the Default output format or leave the value blank and press Enter. If you do not specify a value, the default output format will be json.

  7. Settings will be saved in the configuration files:

    • credentials in .aws/credentials;
    • pool in ~/.aws/config.
  8. In the ~/.aws/config file, add the endpoint_url parameter after the region parameter:

    [default]
    endpoint_url = <log_endpoint>

    Specify <log_endpoint> — the URL for accessing the Logs service API in the desired pool. The list of URLs can be found in the Logs subsection of the List of URLs guide.