Reputation: 1171
I am trying to perform Get-Object operation in AWS. To achieve this, I have followed the below link:
http://docs.aws.amazon.com/cli/latest/reference/s3api/get-object.html
By following this, I have tried executing the below command from my CLI:
aws s3api get-object --bucket test-bucket-1 --key test-object sample.zip
where,
test-bucket-1 is the name of my bucket, test-object is the name of my object, sample.zip is the zip file where I want the contents to be downloaded to.
By doing this, I get the following error:
An error occurred (Invalid Token) when calling the GetObject operation: The provided token is malformed or otherwise invalid.
The user by whom I am performing this action has the following policy attached:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "*",
"Resource": "*"
}
]
}
Am I passing any parameter wrong? Please let me know.
Upvotes: 2
Views: 3316
Reputation: 93511
Even you set the region when you ran aws configure
, you will need to set it again with this command (set the region of bucket ) :
aws s3api get-object --bucket test-bucket-1 --key test-object sample.zip --region <BUCKET-REGION>
It seems weird , but I encountered similar issue before, and the resolution is what I explained.
Of course, the answer assumes you have the right permissions (policy) to access the bucket since you are saying you have Admin access.
Upvotes: 3