I a I'm trying to use aws.s3 library to load data into S3. Below is my code below:
Sys.setenv("AWS_ACCESS_KEY_ID" = ".............",
"AWS_SECRET_ACCESS_KEY" = "...............",
"AWS_DEFAULT_REGION" = "......")
view bucket:
get_bucket(bucket = "....",
check_region = FALSE,
verbose = TRUE)
The code above works and contents of the bucket is returned.
save object to s3:
s3save(data,
object = ".....",
bucket = ".....")
Error return:
List of 4
$ Code : chr "AccessDenied"
$ Message : chr "Access Denied"
$ RequestId: chr ""
$ HostId : chr ""
- attr(*, "headers")=List of 6
..$ x-amz-request-id : chr ""
..$ x-amz-id-2 : chr ""
..$ content-type : chr "application/xml"
..$ transfer-encoding: chr "chunked"
..$ date : chr "Tue, 05 Sep 2017 13:23:42 GMT"
..$ server : chr "AmazonS3"
..- attr(*, "class")= chr [1:2] "insensitive" "list"
- attr(*, "class")= chr "aws_error"
- attr(*, "request_canonical")= chr "GET\n/"| __truncated__
- attr(*, "request_string_to_sign")= car ""| __truncated__
- attr(*, "request_signature")= chr "AWS4-HMAC-SHA256 Credential=|
__truncated__
NULL
Error in parse_aws_s3_response(r, Sig, verbose = verbose) :
Forbidden (HTTP 403).
Any solution to this problem.
The "403 Forbidden" error can occur due to the following reasons: Permissions are missing for s3:PutObject to add an object or s3:PutObjectAcl to modify the object's ACL. You don't have permission to use an AWS Key Management Service (AWS KMS) key. There is an explicit deny statement in the bucket policy.
The "403 Access Denied" error can occur due to the following reasons: Your AWS Identity and Access Management (IAM) user or role doesn't have permissions for both s3:GetBucketPolicy and s3:PutBucketPolicy. The bucket policy denies your IAM identity permission for s3:GetBucketPolicy and s3:PutBucketPolicy.
If you're getting Access Denied errors on public read requests that are allowed, check the bucket's Amazon S3 Block Public Access settings. Review the S3 Block Public Access settings at both the account and bucket level. These settings can override permissions that allow public read access.
The URL to the Amazon S3 object doesn't include your user credentials, so the request to the object is anonymous. Amazon S3 returns an Access Denied error for anonymous requests to objects that aren't public.
It seems like your IAM account is not authorized to do that operation. If you're the owner of the AWS account, you can go to AWS Service IAM, click on users, choose this IAM user and add the necessary authorizations to it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With