18.5.2.2.2. 使用单个命令创建 AWS 资源


如果您不需要在修改 AWS 资源前查看 ccoctl 工具创建的 JSON 文件,并且如果 ccoctl 工具用于创建 AWS 资源的过程会自动满足您的要求,则可以使用 ccoctl aws create-all 命令自动创建 AWS 资源。

否则,您可以单独创建 AWS 资源。

注意

默认情况下,ccoctl 在运行命令的目录中创建对象。要在其他目录中创建对象,请使用 --output-dir 标志。此流程使用 &lt ;path_to_ccoctl_output_dir > 来引用此目录。

先决条件

  • 提取并准备 ccoctl 二进制文件。

流程

  1. 从 OpenShift Container Platform 发行镜像中提取 CredentialsRequest 对象列表:

    $ oc adm release extract \
    --credentials-requests \
    --cloud=aws \
    --to=<path_to_directory_with_list_of_credentials_requests>/credrequests \ 
    1
    
    --from=quay.io/<path_to>/ocp-release:<version>
    Copy to Clipboard Toggle word wrap
    1
    credrequests 是存储 CredentialsRequest 对象列表的目录。如果该目录不存在,此命令就会创建该目录。
  2. 使用 ccoctl 工具处理 credrequests 目录中的所有 CredentialsRequest 对象:

    $ ccoctl aws create-all \
    --name=<name> \
    --region=<aws_region> \
    --credentials-requests-dir=<path_to_directory_with_list_of_credentials_requests>/credrequests
    Copy to Clipboard Toggle word wrap

验证

  • 要验证 OpenShift Container Platform secret 是否已创建,列出 <path_to_ccoctl_output_dir>/manifests 目录中的文件:

    $ ll <path_to_ccoctl_output_dir>/manifests
    Copy to Clipboard Toggle word wrap

    输出示例:

    total 24
    -rw-------. 1 <user> <user> 161 Apr 13 11:42 cluster-authentication-02-config.yaml
    -rw-------. 1 <user> <user> 379 Apr 13 11:59 openshift-cloud-credential-operator-cloud-credential-operator-iam-ro-creds-credentials.yaml
    -rw-------. 1 <user> <user> 353 Apr 13 11:59 openshift-cluster-csi-drivers-ebs-cloud-credentials-credentials.yaml
    -rw-------. 1 <user> <user> 355 Apr 13 11:59 openshift-image-registry-installer-cloud-credentials-credentials.yaml
    -rw-------. 1 <user> <user> 339 Apr 13 11:59 openshift-ingress-operator-cloud-credentials-credentials.yaml
    -rw-------. 1 <user> <user> 337 Apr 13 11:59 openshift-machine-api-aws-cloud-credentials-credentials.yaml
    Copy to Clipboard Toggle word wrap

您可以通过查询 AWS 来验证是否已创建 IAM 角色。如需更多信息,请参阅有关列出 IAM 角色的 AWS 文档。

返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

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

让开源更具包容性

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

關於紅帽

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

Theme

© 2025 Red Hat