Q:

accessing an existing Amazon S3 bucket

I'm trying to make an app that uploads images to an S3 service. from what I read in the documentation and from the sample project, I saw that it's fairly easy to create a bucket and upload an Image to it and that is no problem, but how do I test if the bucket already exists and connect to it if it does?
my code is taken from the Amazon sample project but I'll add it anyway:
    case R.id.button_upload:
        if (flag && fileUri != null) {
            Uri selectedImage = fileUri;
            String[] filePathColumn = { MediaStore.Images.Media.DATA };

            Cursor cursor = getContentResolver().query(selectedImage,
                    filePathColumn, null, null, null);
            cursor.moveToFirst();

            int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
            String filePath = cursor.getString(columnIndex);
            cursor.close();

            // Put the image data into S3.
            try {
                s3Client.createBucket(Constants.getPictureBucket());
                // I DON"T WANT TO CREATE ONE, I WANT TO CONNECT TO ONE

                PutObjectRequest por = new PutObjectRequest(
                        Constants.getPictureBucket(),
                        Constants.PICTURE_NAME, new java.io.File(filePath)); // Content
                                                                                // type
                                                                                // is
                                                                                // determined
                                                                                // by
                                                                                // file
                                                                                // extension.
                s3Client.putObject(por);
            } catch (Exception exception) {
                displayAlert("Upload Failure", exception.getMessage());
            }
        }
        break;

any thoughts on how to connect to an existing bucket?

A:

You should not create many buckets. One should be enough and then just have folders in it.
 String bucket = "foo";
 File file = new File(fileName);
 //Just set your directory 
 PutObjectRequest request = new PutObjectRequest(bucket,"thumbnails/" +  fileName, file)
 .withCannedAcl(CannedAccessControlList.PublicRead)
 .withMetadata(meta);
 client.putObject(request);

