I am trying to upload file to S3 but AWS is not allowing. I am owner of this bucket so why it is saying I have no permission?? Very frustrating. I think AWS is bug.
I already set my credentials properly but still not working. See below what I did: yes
export AWS_ACCESS_KEY_ID=AKIAEXAMPLE
export AWS_SECRET_ACCESS_KEY=exampleexample
export AWS_REGION=us-east-1
Then I run this command:
aws s3 cp myfile.txt s3://my-private-bucket/
But I get this error always:
An error occurred (AccessDenied) when calling the PutObject operation:
User: arn:aws:iam::987654321098:user/rajitpbhartan is not authorized to perform: s3:PutObject on resource: arn:aws:s3:::my-private-bucket/myfile.txt
Traceback (most recent call last):
File "C:\Users\rajitpbhartan\AppData\Local\Programs\Python\Python39\site-packages\botocore\auth.py", line 373, in add_auth
raise NoCredentialsError()
botocore.exceptions.NoCredentialsError: Unable to locate credentials
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Program Files\Amazon\AWSCLI\bin\aws", line 19, in <module>
main()
File "C:\Users\rajitpbhartan\AppData\Local\Programs\Python\Python39\site-packages\awscli\clidriver.py", line 55, in main
return driver.main()
File "C:\Users\rajitpbhartan\AppData\Local\Programs\Python\Python39\site-packages\awscli\clidriver.py", line 78, in main
self._emit_first_time_use_event()
File "C:\Users\rajitpbhartan\AppData\Local\Programs\Python\Python39\site-packages\awscli\clidriver.py", line 87, in _emit_first_time_use_event
self.session.emit('session-initialized', session=self.session)
File "C:\Users\rajitpbhartan\AppData\Local\Programs\Python\Python39\site-packages\botocore\hooks.py", line 356, in emit
return self._emit(event_name, kwargs)
File "C:\Users\rajitpbhartan\AppData\Local\Programs\Python\Python39\site-packages\botocore\hooks.py", line 239, in _emit
return self._emit_internal(event_name, kwargs)
File "C:\Users\rajitpbhartan\AppData\Local\Programs\Python\Python39\site-packages\botocore\hooks.py", line 223, in _emit_internal
return self._emit_until_response(event_name, kwargs)
File "C:\Users\rajitpbhartan\AppData\Local\Programs\Python\Python39\site-packages\botocore\hooks.py", line 206, in _emit_until_response
responses.append(handler(**kwargs))
File "C:\Users\rajitpbhartan\AppData\Local\Programs\Python\Python39\site-packages\botocore\credentials.py", line 1308, in _retrieve_credentials
raise botocore.exceptions.PartialCredentialsError(provider=self._profile_name, cred_var='aws_secret_access_key')
botocore.exceptions.PartialCredentialsError: The security token included in the request is invalid.
��#—˜{…pwxâ–‡ÅN<|>
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Program Files\Amazon\AWSCLI\bin\aws", line 19, in <module>
main()
File "C:\Users\rajitpbhartan\AppData\Local\Programs\Python\Python39\site-packages\awscli\clidriver.py", line 55, in main
return driver.main()
File "C:\Users\rajitpbhartan\AppData\Local\Programs\Python\Python39\site-packages\awscli\clidriver.py", line 78, in main
self._emit_first_time_use_event()
File "C:\Users\rajitpbhartan\AppData\Local\Programs\Python\Python39\site-packages\awscli\clidriver.py", line 87, in _emit_first_time_use_event
self.session.emit('session-initialized', session=self.session)
File "C:\Users\rajitpbhartan\AppData\Local\Programs\Python\Python39\site-packages\botocore\hooks.py", line 356, in emit
return self._emit(event_name, kwargs)
File "C:\Users\rajitpbhartan\AppData\Local\Programs\Python\Python39\site-packages\botocore\hooks.py", line 239, in _emit
return self._emit_internal(event_name, kwargs)
File "C:\Users\rajitpbhartan\AppData\Local\Programs\Python\Python39\site-packages\botocore\hooks.py", line 223, in _emit_internal
return self._emit_until_response(event_name, kwargs)
File "C:\Users\rajitpbhartan\AppData\Local\Programs\Python\Python39\site-packages\botocore\hooks.py", line 206, in _emit_until_response
responses.append(handler(**kwargs))
File "C:\Users\rajitpbhartan\AppData\Local\Programs\Python\Python39\site-packages\botocore\credentials.py", line 1308, in _retrieve_credentials
raise botocore.exceptions.PartialCredentialsError(provider=self._profile_name, cred_var='aws_secret_access_key')
botocore.exceptions.PartialCredentialsError: The security token included in the request is invalid.
UnicodeDecodeError: 'utf-16' codec can't decode byte 0x85 in position 19: invalid start byte
👉error detected at pos 742 "è?¾…{pwx†ÅN¬@!"
I already give admin access to my user so how is possible? Also tried using sudo but still same. I think AWS is making problem.
I was doing sudo and running with bash but it gives me this error\
thank you and please answer me this is long time I experience this and i need to able to be to put the files in the s3 buckets that i have why does aws not allow me
I am trying to upload file to S3 but AWS is not allowing. I am owner of this bucket so why it is saying I have no permission?? Very frustrating. I think AWS is bug.
I already set my credentials properly but still not working. See below what I did: yes
export AWS_ACCESS_KEY_ID=AKIAEXAMPLE
export AWS_SECRET_ACCESS_KEY=exampleexample
export AWS_REGION=us-east-1
Then I run this command:
aws s3 cp myfile.txt s3://my-private-bucket/
But I get this error always:
An error occurred (AccessDenied) when calling the PutObject operation:
User: arn:aws:iam::987654321098:user/rajitpbhartan is not authorized to perform: s3:PutObject on resource: arn:aws:s3:::my-private-bucket/myfile.txt
Traceback (most recent call last):
File "C:\Users\rajitpbhartan\AppData\Local\Programs\Python\Python39\site-packages\botocore\auth.py", line 373, in add_auth
raise NoCredentialsError()
botocore.exceptions.NoCredentialsError: Unable to locate credentials
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Program Files\Amazon\AWSCLI\bin\aws", line 19, in <module>
main()
File "C:\Users\rajitpbhartan\AppData\Local\Programs\Python\Python39\site-packages\awscli\clidriver.py", line 55, in main
return driver.main()
File "C:\Users\rajitpbhartan\AppData\Local\Programs\Python\Python39\site-packages\awscli\clidriver.py", line 78, in main
self._emit_first_time_use_event()
File "C:\Users\rajitpbhartan\AppData\Local\Programs\Python\Python39\site-packages\awscli\clidriver.py", line 87, in _emit_first_time_use_event
self.session.emit('session-initialized', session=self.session)
File "C:\Users\rajitpbhartan\AppData\Local\Programs\Python\Python39\site-packages\botocore\hooks.py", line 356, in emit
return self._emit(event_name, kwargs)
File "C:\Users\rajitpbhartan\AppData\Local\Programs\Python\Python39\site-packages\botocore\hooks.py", line 239, in _emit
return self._emit_internal(event_name, kwargs)
File "C:\Users\rajitpbhartan\AppData\Local\Programs\Python\Python39\site-packages\botocore\hooks.py", line 223, in _emit_internal
return self._emit_until_response(event_name, kwargs)
File "C:\Users\rajitpbhartan\AppData\Local\Programs\Python\Python39\site-packages\botocore\hooks.py", line 206, in _emit_until_response
responses.append(handler(**kwargs))
File "C:\Users\rajitpbhartan\AppData\Local\Programs\Python\Python39\site-packages\botocore\credentials.py", line 1308, in _retrieve_credentials
raise botocore.exceptions.PartialCredentialsError(provider=self._profile_name, cred_var='aws_secret_access_key')
botocore.exceptions.PartialCredentialsError: The security token included in the request is invalid.
��#—˜{…pwxâ–‡ÅN<|>
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Program Files\Amazon\AWSCLI\bin\aws", line 19, in <module>
main()
File "C:\Users\rajitpbhartan\AppData\Local\Programs\Python\Python39\site-packages\awscli\clidriver.py", line 55, in main
return driver.main()
File "C:\Users\rajitpbhartan\AppData\Local\Programs\Python\Python39\site-packages\awscli\clidriver.py", line 78, in main
self._emit_first_time_use_event()
File "C:\Users\rajitpbhartan\AppData\Local\Programs\Python\Python39\site-packages\awscli\clidriver.py", line 87, in _emit_first_time_use_event
self.session.emit('session-initialized', session=self.session)
File "C:\Users\rajitpbhartan\AppData\Local\Programs\Python\Python39\site-packages\botocore\hooks.py", line 356, in emit
return self._emit(event_name, kwargs)
File "C:\Users\rajitpbhartan\AppData\Local\Programs\Python\Python39\site-packages\botocore\hooks.py", line 239, in _emit
return self._emit_internal(event_name, kwargs)
File "C:\Users\rajitpbhartan\AppData\Local\Programs\Python\Python39\site-packages\botocore\hooks.py", line 223, in _emit_internal
return self._emit_until_response(event_name, kwargs)
File "C:\Users\rajitpbhartan\AppData\Local\Programs\Python\Python39\site-packages\botocore\hooks.py", line 206, in _emit_until_response
responses.append(handler(**kwargs))
File "C:\Users\rajitpbhartan\AppData\Local\Programs\Python\Python39\site-packages\botocore\credentials.py", line 1308, in _retrieve_credentials
raise botocore.exceptions.PartialCredentialsError(provider=self._profile_name, cred_var='aws_secret_access_key')
botocore.exceptions.PartialCredentialsError: The security token included in the request is invalid.
UnicodeDecodeError: 'utf-16' codec can't decode byte 0x85 in position 19: invalid start byte
👉error detected at pos 742 "è?¾…{pwx†ÅN¬@!"
I already give admin access to my user so how is possible? Also tried using sudo but still same. I think AWS is making problem.
I was doing sudo and running with bash but it gives me this error\
thank you and please answer me this is long time I experience this and i need to able to be to put the files in the s3 buckets that i have why does aws not allow me
Share Improve this question edited Feb 17 at 7:47 ewokx 2,4253 gold badges17 silver badges41 bronze badges asked Feb 17 at 7:36 user29668747user29668747 91 bronze badge New contributor user29668747 is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct. 4 |1 Answer
Reset to default -1Try to configure aws access key and secret keys using aws configure
command
Here is the command
aws configure --profile default
then provide the access key, secret key, region and format
Using CLI
Run the aws cp command once you done setting up
aws s3 cp myfile.txt s3://my-private-bucket/
Using Python
Python boto3 will consider the key configuration so you can just create boto3 client
import boto3
s3 = boto3.resource('s3')
if you want to explicitly provide aws access key and secret key in your python boto3
import boto3
session = boto3.Session(
aws_access_key_id=ACCESS_KEY,
aws_secret_access_key=SECRET_KEY,
aws_session_token=SESSION_TOKEN
)
rajitpbhartan
is not authorised to upload the file. It is then saying that it could not locate credentials, but it already used some credentials! The third error typically means that you are using temporary credentials from the Security Token Service rather than credentials from an IAM User. It shouldn't be possible to get all 3 errors at the same time. Are you showing the error exactly as it displays on your screen? Where did you obtain your Access Key and Secret Key? – John Rotenstein Commented Feb 18 at 2:26