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.
CodePudding user response:
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.