准备工作
-
如果您尚未设置身份验证,请进行设置。身份验证用于验证您的身份,以便访问 Trusted Cloud by S3NS 服务和 API。如需从本地开发环境运行代码或示例,您可以通过选择以下选项之一向 Compute Engine 进行身份验证:
Select the tab for how you plan to use the samples on this page:
Console
When you use the Trusted Cloud console to access Trusted Cloud by S3NS services and APIs, you don't need to set up authentication.
gcloud
-
安装 Google Cloud CLI,然后使用联合身份登录 gcloud CLI。 登录后,运行以下命令来初始化 Google Cloud CLI:
gcloud init
- Set a default region and zone.
REST
如需在本地开发环境中使用本页面上的 REST API 示例,请使用您提供给 gcloud CLI 的凭证。
安装 Google Cloud CLI,然后使用联合身份登录 gcloud CLI。 登录后,运行以下命令来初始化 Google Cloud CLI:
gcloud init
如需了解详情,请参阅 Trusted Cloud 身份验证文档中的使用 REST 时进行身份验证。
所需的角色
如需获得为 Ops Agent 监控和日志记录创建实例所需的权限,请让管理员向您授予项目的以下 IAM 角色:
-
Compute Instance Admin (v1) (
roles/compute.instanceAdmin.v1
) -
如需在实例上安装 Ops Agent,请执行以下操作:
OSPolicyAssignment Editor (
roles/osconfig.osPolicyAssignmentEditor
)
如需详细了解如何授予角色,请参阅管理对项目、文件夹和组织的访问权限。
在实例上安装 Ops Agent
您只能在现有实例上安装 Ops Agent。如需在单个实例或实例舰队上安装 Ops Agent,您可以使用Trusted Cloud 控制台、gcloud CLI 或自动化工具。如需查看相关说明,请参阅安装 Ops Agent。
后续步骤
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-09-19。
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["没有我需要的信息","missingTheInformationINeed","thumb-down"],["太复杂/步骤太多","tooComplicatedTooManySteps","thumb-down"],["内容需要更新","outOfDate","thumb-down"],["翻译问题","translationIssue","thumb-down"],["示例/代码问题","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-09-19。"],[],[],null,[]] -