AWSJavaSDKV1-无法从S3Intelligent-TieringDeepArchive访问恢复对象
创始人
2024-09-25 23:00:51
0

AWS Java SDK V1没有提供直接从S3智能分层深度归档存储访问和恢复对象的功能。但是,可以通过以下方法实现此操作:

在使用AmazonS3Client实例时,可以使用AmazonS3EncryptionClient类替换它,从而允许客户端读取S3 Intelligent-Tiering存储类别的对象。

以下是使用AmazonS3EncryptionClient类的代码示例:

import com.amazonaws.AmazonClientException;
import com.amazonaws.auth.AWSCredentials;
import com.amazonaws.auth.BasicAWSCredentials;
import com.amazonaws.encryptionsdk.AwsCrypto;
import com.amazonaws.encryptionsdk.kms.KmsMasterKeyProvider;
import com.amazonaws.encryptionsdk.kms.KmsMasterKeyProviderBuilder;
import com.amazonaws.encryptionsdk.kms.KmsMasterKeyProviderBuilder.KeyProviderSpec;
import com.amazonaws.services.s3.AmazonS3;
import com.amazonaws.services.s3.AmazonS3EncryptionClient;
import com.amazonaws.services.s3.AmazonS3EncryptionClientBuilder;
import com.amazonaws.services.s3.model.ObjectMetadata;
import com.amazonaws.services.s3.model.PutObjectResult;

import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;

public class S3EncryptionExample {

    private static final String BUCKET_NAME = "example-bucket";
    private static final String OBJECT_KEY = "example-key";

    private static final String AWS_ACCESS_KEY_ID = "AWS_ACCESS_KEY_ID";
    private static final String AWS_SECRET_ACCESS_KEY = "AWS_SECRET_ACCESS_KEY";

    public static void main(String[] args) {

        AWSCredentials credentials = new BasicAWSCredentials(
            System.getenv(AWS_ACCESS_KEY_ID),
            System.getenv(AWS_SECRET_ACCESS_KEY)
        );

        KmsMasterKeyProvider keyProvider = new KmsMasterKeyProviderBuilder()
            .withKeyIds("alias/example-key")
            .buildStrict(KmsMasterKeyProviderBuilder.KeyProviderSpec.AWS_KMS);

        AwsCrypto crypto = new AwsCrypto();
        AmazonS3 s3Client = new AmazonS3EncryptionClientBuilder()
            .withCredentials(credentials

相关内容

热门资讯

大菠萝789辅助器下载!we ... 大菠萝789辅助器下载!we poker辅助器(透视)工具-竟然必备存在有挂1、许多玩家不知道大菠萝...
透视曝光!pokemmo手机版... 透视曝光!pokemmo手机版脚本(透视)hhpoker透视方法,教程讲义(有挂分析)-哔哩哔哩1、...
德普之星有透视辅助吗!poke... 德普之星有透视辅助吗!pokemmo脚本手机版(透视)挂-其实辅助存在有挂德普之星有透视辅助吗破解侠...
透视解谜!hhpoker德州机... 透视解谜!hhpoker德州机器人(透视)德州透视插件,教程手筋(有挂规律)-哔哩哔哩1、完成hhp...
德州局脚本!hhpoker德州... 德州局脚本!hhpoker德州透视(透视)技巧-真是透视存在有挂1、hhpoker德州透视公共底牌简...
透视解谜!sohoo辅助(透视... 透视解谜!sohoo辅助(透视)hhpoker怎么开透视,教程手段(证实有挂)-哔哩哔哩1、hhpo...
wepoker究竟有没有透视!... wepoker究竟有没有透视!wepoker有辅助工具吗(透视)攻略-原来开挂真的有挂1、金币登录送...
透视透视!聚星ai辅助工具收费... 透视透视!聚星ai辅助工具收费多少(透视)aapoker插件,教程指南(有挂教程)-哔哩哔哩聚星ai...
wepoker私人局怎么玩!德... 您好,wepoker私人局怎么玩这款游戏可以开挂的,确实是有挂的,需要了解加去威信【13670430...
透视曝光!htx矩阵wepok... 透视曝光!htx矩阵wepoker辅助(透视)hhpoker智能辅助插件,教程秘籍(有挂教学)-哔哩...