Manas Singh
Manas Singh

Reputation: 73

S3 bucket given name versus physical name Cloudformation

I created a bucket with name "my-bucket", cloudformation creates it as "StackName-my-bucket-{random text}". I want to read from this bucket in the java code, what would be the right way to access provided I cannot touch anything in cloudformation.

Upvotes: 1

Views: 348

Answers (1)

petrch
petrch

Reputation: 1968

Assuming you cannot modify the CloudFormation template and it does not have the bucket as an output variable - You can list buckets in the current AWS account. You need the s3:ListAllMyBuckets permission for doing so. Then you can search for your bucket name. If you need to search in multiple accounts, you need to assume a role in every account. There is no "ListAllBucketsInAllAccounts" permission.

Upvotes: 2

Related Questions