Pages

Monday, July 24, 2023

S3 Bucket delete policy & Identify the Role ID of IAM Role

 We always face the below issue.

While updating the Bucket policy we miss to add our Admin ID under resources and hence we loose permission to modify the bucket. Since Bucket name is unique, we can't create another bucket with same name and we can't access the objects in bucket. so below is the command to delete the corrupted Policy.

aws s3api delete-bucket-policy --bucket my-bucket

After this our bucket will be open to all and we can re-create the policy for the bucket.



To find the Role Name, please run the below command,

aws iam list-roles --query 'Roles[?RoleId==`AROA3ZBMXHWABAXXXXX`]'


To find the Role ID, please run the below command,

aws iam list-roles --query 'Roles[?RoleName==`XXXX-prod-abcd-portal-zdt`]'



No comments:

Post a Comment