Skip to content

Get detailed Storage metrics with the AWS CLI

Supabase Studio 主要列出你桶里的当前对象。你可以使用标准的 S3 工具,比如 AWS CLI,来查看你的 Supabase 项目存储使用情况,或者对桶内容进行操作。

🌐 Supabase Studio primarily lists the current objects within your buckets. You can use standard S3 tooling such as the AWS CLI to review your Supabase project's Storage usage, or perform operations on the bucket contents.

如何获取详细的存储指标 #

🌐 How to get detailed storage metrics

本指南使用官方的 AWS CLI。你需要在电脑上本地安装它,才能继续接下来的步骤。

🌐 This guide makes use of the official AWS CLI. You need to install it locally on your computer in order to follow the next steps.

  1. 获取凭证: 生成一对访问密钥(访问密钥 ID 和秘密访问密钥),并在你项目的存储配置中找到存储端点。请注意,秘密访问密钥只会在创建新访问密钥时显示一次。

  2. 识别端点和区域:在存储配置的连接部分找到你项目的存储端点和区域

  3. 配置 AWS CLI: 你可以在本地终端通过环境变量来配置访问凭证:

    1
    export AWS_ACCESS_KEY_ID='<access-key-id>'
    2
    export AWS_SECRET_ACCESS_KEY='<secret-access-key>'
    3
    export AWS_DEFAULT_REGION='<storage-region>'
  4. 列出存储桶: 通过列出你项目的存储桶来确认你的设置:

    1
    aws s3api list-buckets --endpoint-url <storage-endpoint-url>
  5. 查看存储桶内容和大小: 获取特定存储桶内容的详细信息和总量:

    1
    aws s3 ls s3://<example-bucket>/ --endpoint-url <storage-endpoint-url> --recursive --human-readable --summarize

在上面的命令中,确保将 <example-bucket><storage-endpoint-url> 替换为你桶的实际信息。

🌐 In the above commands make sure to replace <example-bucket> and <storage-endpoint-url> with the actual details of your bucket.