Can't delete directory from Amazon S3

前端 未结 10 2135
醉梦人生
醉梦人生 2021-02-12 07:19

I\'m using the web interface of Amazon\'s S3, and when I right-click a folder X and choose Delete, X seems to be deleted. Then when I refresh the interface, X may either disappe

相关标签:
10条回答
  • 2021-02-12 08:10

    Tried various alternatives to delete from Web interface to delete a folder with sub folders in it without luck. I had an installation of S3 browser and then tried from S3 Browser interface, worked.

    0 讨论(0)
  • 2021-02-12 08:12

    I had the same problem and didn't have access to the amazon console but I could delete it with this Java code

        AmazonS3Client amazonS3Client = new AmazonS3Client(basicAWSCredentials);
        ObjectListing objectListing = amazonS3Client.listObjects("bucketName", "prefix");
        DeleteObjectsRequest deleteObjectsRequest = new DeleteObjectsRequest("bucketName");
        List<DeleteObjectsRequest.KeyVersion> keysToDelete = new ArrayList<>();
        objectListing.getObjectSummaries().forEach(s3ObjectSummary -> {
            keysToDelete.add(new DeleteObjectsRequest.KeyVersion(s3ObjectSummary.getKey()));
        });
        deleteObjectsRequest.setKeys(keysToDelete);
        amazonS3Client.deleteObjects(deleteObjectsRequest);
    

        <dependency>
            <groupId>com.amazonaws</groupId>
            <artifactId>aws-java-sdk</artifactId>
            <version>1.7.4</version>
        </dependency>
    
    0 讨论(0)
  • 2021-02-12 08:13

    S3 does not actually use folders. Instead the path separators in object paths are treated like folders. If you want to remove a folder, all the contents of the folder will have to get deleted.

    If there is any delay in deleting all of the contents, the folder may continue to exist.

    0 讨论(0)
  • 2021-02-12 08:14

    I have the same problem that I cant delete a s3 bucket, with the message "An error occurred (AccessDenied) when calling the DeleteBucket operation: Access Denied"

    After a while, I delete the bucket policy in tab "permission" button "bucket policy" and It worked like a charm, with:

    aws s3 rb s3://elasticbeanstalk-us-west-..../ --force

    I hope this help! Is another option Pablo

    0 讨论(0)
提交回复
热议问题