Sign in
agent:

List all customer managed IAM policies in the AWS region us-east-2.

There was a problem that the LLM was not able to address. Please rephrase your prompt and try again.
The script lists all customer managed IAM policies in the specified AWS region.
import boto3 import json # Initialize IAM client with credentials iam_client = boto3.client( 'iam', region_name='us-east-2', aws_access_key_id=getEnvVar('AWS_ACCESS_KEY_ID'), aws_secret_access_key=getEnvVar('AWS_SECRET_ACCESS_KEY') ) # List all customer managed policies response = iam_client.list_policies(Scope='Local') # Extract policy names policies = [policy['PolicyName'] for policy in response['Policies']] # Print the list of policies print(json.dumps(policies, indent=4))
copied