系统学习 DevOps 学习路径:从版本控制到可观测与供应链

oci

Oracle Cloud 命令行接口

补充说明

oci 是 Oracle Cloud Infrastructure CLI,按服务组织命令,例如 oci compute、oci os、oci ce。它依赖 profile、tenancy OCID、region 和认证方式。

常用示例

oci setup config
oci iam user list
oci compute instance list --compartment-id <compartment-ocid>
oci compute instance launch \
  --compartment-id <compartment-ocid> \
  --availability-domain <ad> \
  --shape VM.Standard.E4.Flex \
  --image-id <image-ocid>
oci os object put --bucket-name my-bucket --file ./app.zip
oci os object get --bucket-name my-bucket --name app.zip --file ./app.zip
oci ce cluster create-kubeconfig \
  --cluster-id <cluster-ocid> --file ~/.kube/config
oci --profile prod --output table compute instance list \
  --compartment-id <compartment-ocid> --all

易错点与排错

相关命令

参考链接

读完自测

合上页面,先回答,再展开对照。

  1. 大多数 OCI 资源按什么隔离?漏传 --compartment-id 会怎样?
  2. 列表命令默认只返回部分结果,怎么拿全量?
  3. CI 中应优先使用哪种认证方式?
答案
  1. 按 compartment 隔离;不传 --compartment-id 会看不到资源或建错位置。
  2. 默认分页,需要全量时加 --all,否则只拿到第一页。
  3. 优先用 instance principal 或联邦认证,避免在 CI 中长期保存 API 私钥。
微信小程序码:扫码打开命令速查小程序

小程序版

微信扫码,随时查命令