https://pulumi.com logo
#python
Title
# python
a

agreeable-toddler-25853

09/18/2020, 7:34 AM
HI All, Is there a way to get a list of all the IAM policies
m

millions-furniture-75402

09/18/2020, 1:19 PM
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

agreeable-toddler-25853

09/18/2020, 1:56 PM
Thanks, can you point me to the documentation for directly using the aws sdk in pulumi as you suggest above
m

millions-furniture-75402

09/18/2020, 2:31 PM
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

agreeable-toddler-25853

09/18/2020, 2:47 PM
Thanks, for pointing me in the right direction
👍 1