如何使用 AWS 创建内联策略 API

How to create inline policy with AWS API

我正在编写需要在 Java 中以编程方式创建 IAM 角色的代码。我想要附加到角色的内联策略而不是托管策略。我只能找到example and doc分别创建角色和托管策略,然后将托管策略附加到现有的IAM角色。

如何使用内联策略创建 IAM 角色?

在Java中有putRolePolicy

Adds or updates an inline policy document that is embedded in the specified IAM role.