'How can I access the S3 bucket from internet?
At first, I make the S3 bucket with this script.
const out_bk = new s3.Bucket(this, 'out-bk', { // image-resize用のbucket
bucketName: s3_out_name,
removalPolicy: RemovalPolicy.DESTROY,
autoDeleteObjects: true,
cors: [{
allowedMethods: [
s3.HttpMethods.GET,
s3.HttpMethods.POST,
s3.HttpMethods.PUT,
s3.HttpMethods.DELETE,
s3.HttpMethods.HEAD,
],
allowedHeaders: ["*"],
allowedOrigins: ["*"],
exposedHeaders: ["ETag"],
maxAge: 3000
}]
});
const s3_out_name = "s3-my-out-name"
const out_bk = new s3.Bucket(this, 'cdk-st-out-bk', {
bucketName: s3_out_name,
removalPolicy: RemovalPolicy.DESTROY,
autoDeleteObjects: true,
cors: [{
allowedMethods: [
s3.HttpMethods.GET,
s3.HttpMethods.POST,
s3.HttpMethods.PUT,
s3.HttpMethods.DELETE,
s3.HttpMethods.HEAD,
],
allowedHeaders: ["*"],
allowedOrigins: ["*"],
exposedHeaders: ["ETag"],
maxAge: 3000
}]
});
const cfnAccessPoint = new s3.CfnAccessPoint(this, 'MyCfnAccessPoint', {
bucket: s3_out_name,
name: 's3-access-point',
publicAccessBlockConfiguration: {
blockPublicAcls: false,
blockPublicPolicy: false,
ignorePublicAcls: false,
restrictPublicBuckets: false,
},
});
then S3 and Access point are successfully created.
I open the aws console -> S3 -> access point-> item
There is a object URL like this,
https://s3-access-point-69853XXXXXX.s3-accesspoint.ap-northeast-1.amazonaws.com/1040
When access here from the browser .
There appares this error, It's something related with authorization.
I want to access this from browser without authorization.
How can I fix this??
<Error>
<script/>
<Code>InvalidRequest</Code>
<Message>The authorization mechanism you have provided is not supported. Please use Signature Version 4.</Message>
<RequestId>YVMHMBJP2D4WDJAK</RequestId>
<HostId>yLesp53LUmB7/rMHkZMAwcMej37WRQOKnbWI4vwhh3xCKY1t60eDd1YiJ+4xRAw3kYWjlI1Csnw=</HostId>
</Error>
I am trying to access without Access Point
My block public access is off.
Give everyone the privilidge for read ,list on ACL.
then accessing object URL by browser
but still comes error
<Error>
<script/>
<Code>AccessDenied</Code>
<Message>Access Denied</Message>
<RequestId>Y6DPF5RWZ59DTQJD</RequestId>
<HostId>9pXKB5EDTmE6t9AJvwyTQHtyCMokeETw9yR+BFF4JdfDZ0NbfMf3TX1+VzrrJlfULBQOUtaTNM8=</HostId>
</Error>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
