HI All, Is there a way to get a list of all the IA...
# python
a
HI All, Is there a way to get a list of all the IAM policies
m
If you can do it through the cli, you can most likely do it through the AWS SDK, if you can do it through the AWS SDK, it’s likely the Pulumi AWS Provider can do it represented as component resource objects in pulumi.
Copy code
aws iam list-policies
https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/iam.html#IAM.Client.list_policies Though, I’m not seeing a method on
iam.Policy
for
.list_policies()
. The aws sdk is also available directly in pulumi.
a
Thanks, can you point me to the documentation for directly using the aws sdk in pulumi as you suggest above
m
I’ve been using pulumi with TypeScript, but Python should be somewhat similar. In TS, there is an
sdk
property that has the AWS SDK instance. Then I setup the client I need for the service, and call the method needed:
Copy code
import * as aws from "@pulumi/aws";

const iamClient = new aws.sdk.IAM();
const policies = iamClient.listPolicies();
console.log(polices);
a
Thanks, for pointing me in the right direction
👍 1