Firstly, you need to find your Canonical ID. (https://www.teachonetofish.net/aws-iam-cli/)
The canonical user ID is the Amazon S3–only concept. It is a 64-character obfuscated version of the account ID. Therefore you can’t get anything out of the canonical user ID because it’s almost certainly a one-way hash.
aws s3api list-buckets --query Owner.ID --output text
b3dd23678902c3789775cd1371268365
Then, you can find the bucket ID to see if it matches your ID.
aws s3api get-bucket-acl --bucket bucket-name --output json
{
"Owner": {
"ID": "b3dd23fdfeb2c3789775cd1371268365"
},
"Grants": [
{
"Grantee": {
"ID": "b3dd23fdfeb2c3789775cd1371268365",
"Type": "CanonicalUser"
},
"Permission": "FULL_CONTROL"
}
]
}