Skip to content

Instantly share code, notes, and snippets.

@batok
Created September 21, 2010 00:16
Show Gist options
  • Save batok/588913 to your computer and use it in GitHub Desktop.
Save batok/588913 to your computer and use it in GitHub Desktop.
# works with python 2.7
import boto, sys, json
c = boto.connect_iam()
user = sys.argv[1]
policy_name = "list_all_buckets_{}".format( user )
policy = json.dumps(dict( Statement = [ dict(Effect = "Allow", Action = "s3:ListAllMyBuckets" , Resource = "arn:aws:s3:::*"),]))
response = c.put_user_policy( user, policy_name, policy)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment