1. 新建账户,拿到access key 和 secret
2. 下载安装aws 客户端,使用aws config 配置密钥和rigion, 或者直接在~/.aws/ 下新建credentials,config文件
样例如下
credentials 文件内
[default]
aws_access_key_id = AKxxxxI2
aws_secret_access_key = 8NFxxxxxe8
3. OSS控制台建立bucket,配置设置,一般不建议公开可访问
4. 代码如下
<aws.version>1.12.349</aws.version>
<!-- all aws sdk -->
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-bom</artifactId>
<version>${aws.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
子maven
<!-- aws oss sdk -->
<dependency>
<artifactId>aws-java-sdk-s3</artifactId>
<groupId>com.amazonaws</groupId>
</dependency>
发表回复