In 2021 Ben Bridts published a highly inventive method for finding the AWS Account ID of a public S3 bucket. This post describes a technique to find the Account ID of any S3 bucket (both private and public). I'd highly recommend reading Ben's technique first as we will re-use a lot of concepts. S3 Bucket to AWS Account ID Shell output can be worth a thousand words, here's what our technique enable
![How to find the AWS Account ID of any S3 Bucket](https://cdn-ak-scissors.b.st-hatena.com/image/square/52014e138c37eeb29e71db878fd562f6585fd429/height=288;version=1;width=512/https%3A%2F%2Ftracebit.com%2Fimg%2Fblog%2F2024%2F02%2Fusing-role-session-name-in-vpc-endpoint-policy.png)