我有以下s3结构:
存储桶名称:测试存储区
file:test.json
我有以下aws政策:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "s3:PutObject",
"Action": "s3:GetObject",
"Action": "s3:DeleteObject",
"Action": "s3:ListBucket",
"Resource": "arn:aws:s3:::test-bucket"
}
]
}
此政策附加到具有访问密钥123的用户。
当我尝试使用sdk在测试桶中放置或获取test.json时:
BasicAWSCredentials awsCreds = new BasicAWSCredentials("123", "secretKeyId");
s3Client = AmazonS3ClientBuilder.standard()
.withCredentials(new AWSStaticCredentialsProvider(awsCreds))
.withRegion("US-EAST-1")
.build();
s3Client.putObject(new PutObjectRequest("test-bucket", "test.json", file));
这将给出访问拒绝问题。
如果我将策略的资源更改为
"Resource": "*"
然后它会起作用。我只是想确保我放的资源格式正确。出了什么问题?
答案 0 :(得分:1)
你需要让亚马逊知道你的桶旁边还要访问你的桶的内容。
从而改变资源:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Test</title>
<link rel="stylesheet" href="Teststyle.css">
</head>
<body>
<div class="background-wrap">
<video id="video-bg-elem" preload="auto" autoplay="true" loop="loop" muted="muted">
<source src="video.mp4" type="video/mp4">
Video not supported
</video>
</div>
<div class="footer">
<p>footer</p>
</div>
</body>
</html>
类似于:
*{
margin: 0;
padding: 0;
}
body {
font-family: Calibri, sans-serif;
}
.background-wrap {
position: fixed;
z-index: -1000;
width: 100%;
height: 90%;
overflow: hidden;
top: 0;
left: 0;
}
#video-bg-elem {
position: absolute;
top: 0;
left: 0;
min-height: 100%;
min-width: 100%;
}
.content {
position: absolute;
width: 100%;
min-height: 100%;
z-index: 1000;
background-color:rgba(0,0,0,0.5);
}
.content p {
text-align: center;
font-size: 20px;
letter-spacing: 3px;
color: white;
margin-bottom: 50px;
}
.content h1 {
text-align: center;
font-size: 65px;
text-transform: uppercase;
font-weight: 303;
color: #fff;
padding-top: 5%;
margin-bottom: 10px;
}
.footer {
position: absolute;
right: 0;
bottom: 0;
left: 0;
padding: 1rem;
background-color: #efefef;
text-align: center;
}