Reputation: 49
how to access a private file in aws.s3 in angularjs using the api KEY and SECRET
i have the login api key and secret , the file is private , i need to display the file in my browser using angularjs
when i try it gives
<Error>
<Code>AccessDenied</Code>
<Message>Access Denied</Message>
<RequestId>8645A4E13B8C1FA5</RequestId>
<HostId>
0EnuTRDbQ38bVSYORlj8qdpNXxC38LMmsv8n0aMEgiE1LxKImuHKejnSFHtyaBQqEXj9guXOUww=
</HostId>
</Error>
Upvotes: 1
Views: 856
Reputation: 49
{
"Version":"2012-10-17",
"Id":"http referer policy example",
"Statement":[
{
"Sid":"Allow get requests originating from www.example.com and example.com.",
"Effect":"Allow",
"Principal":"*",
"Action":"s3:GetObject",
"Resource":"arn:aws:s3:::examplebucket/*",
"Condition":{
"StringLike":{"aws:Referer":["http://www.example.com/*","http://example.com/*"]}
}
}
]
}
or
{
"Version":"2012-10-17",
"Id":"PolicyForCloudFrontPrivateContent",
"Statement":[
{
"Sid":" Grant a CloudFront Origin Identity access to support private content",
"Effect":"Allow",
"Principal":{"CanonicalUser":"79a59df900b949e55d96a1e698fbacedfd6e09d98eacf8f8d5218e7cd47ef2be"},
"Action":"s3:GetObject",
"Resource":"arn:aws:s3:::example-bucket/*"
}
]
}
change bucket policy
Upvotes: 1