此内容没有您所选择的语言版本。

Chapter 3. Listing available buckets in your object store


To list buckets that are available in your object store, use the list_bucket() method.

Prerequisites

  • You have cloned the odh-doc-examples repository to your workbench.
  • You have opened the s3client_examples.ipynb file in your workbench.
  • You have installed Boto3 and configured the S3 client.

Procedure

  1. In the Jupyter notebook, locate the following instructions that lists available buckets and then run the code cell.

    #List available buckets
    s3_client.list_buckets()

    A successful response includes an HTTP request status code of 200 and a list of buckets, similar to the following output:

    'HTTPStatusCode': 200,
    'Buckets': [{'Name': 'aqs086-image-registry',
    'CreationDate': datetime.datetime(2024, 1, 16, 20, 21, 36, 244000, tzinfo=tzlocal( ))},
  2. Locate the instructions that prints only the names of available buckets and execute the code cell.

    #Print only names of available buckets
    for bucket in s3_client.list_buckets()[‘Buckets’]:
        print(bucket[‘Name’])

    The output displays the names of the buckets, similar to the following example.

    aqs086-image-registry
    aqs087-image-registry
    aqs135-image-registry
    aqs246-image-registry
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2026 Red Hat
返回顶部