InvalidRequest when calling the PutObject operation in AWS
<p>I'm using the following command to verify if my user could access to S3 bucket: (based on this link: <a href="http://docs.aws.amazon.com/AmazonS3/latest/dev/example-walkthroughs-managing-access-example1.html" rel="nofollow">http://docs.aws.amazon.com/AmazonS3/latest/dev/example-walkthroughs-managing-access-example1.html</a>)</p>

<pre><code>$ aws s3api put-object --bucket bymspsbucket --key AWS.png --body Desktop/AWS.png --profile spsadmin
</code></pre>

<p>But I've faced with the following error and stuck on it and no idea what's wrong...</p>

<p>"An error occurred (InvalidRequest) when calling the PutObject operation: Missing required header for this request: x-amz-content-sha256"</p>

<p>I've run the command with --debug</p>

<p>Please see the debug-output file in the following link:
<a href="https://github.com/minafa/AWS/wiki" rel="nofollow">https://github.com/minafa/AWS/wiki</a></p>

<pre><code>$ aws --version
aws-cli/1.10.59 Python/2.7.10 Darwin/15.0.0 botocore/1.4.49
</code></pre>

<p>I've configured config file using cmd: aws configure, the result is as followed:</p>

<pre><code>#vim ./aws/credentials
[default]
aws_access_key_id =
aws_secret_access_key =
[spsadmin]
aws_access_key_id =
aws_secret_access_key =

#vim ./aws/config
</code></pre>

<p>Edited:</p>

<p>As there was no region in the credentials file, I've modified the file manually. So it could work for putobject, but get object gives access deny error:</p>

<pre><code>aws s3api get-object --bucket examplebucket --key AWS.png OutputFile.jpg --profile spsadmin
</code></pre>

<p>An error occurred (AccessDenied) when calling the GetObject operation: Access Denied</p>

<p>The permission that I set in s3 bucket that my user could access on it, is as followed:</p>

<pre><code>"s3:GetBucketLocation",
"s3:ListBucket",
"s3:GetObject", 
"s3:PutObject"
</code></pre>

<p>Does it need to attach the same policy in IAM my user account as well?
Under attach policy of IAM, there is only "AmazonS3FullAccess" that I've set but it should not be FullAccess, because the user must have access to only the bucket that I've assigned.</p>

<p>Any help would be appreciated.</p>