I have been trying to access S3 bucket from a python program running on EC2 instance. The code and error is attached:
from boto.s3.connection import S3Connection
import boto
conn=S3Connection()
bucket=conn.get_bucket('nplr1')
Error:
Traceback (most recent call last):
File "Main.py", line 140, in <module>
main()
File "Main.py", line 33, in main
conn.get_all_buckets()
File "/usr/local/lib/python2.7/dist-packages/boto/s3/connection.py", line 444, in get_all_buckets
response.status, response.reason, body)
boto.exception.S3ResponseError: S3ResponseError: 403 Forbidden
<?xml version="1.0" encoding="UTF-8"?>
<Error><Code>InvalidAccessKeyId</Code><Message>The AWS Access Key Id you provided does not exist in our records.</Message>
This is my /etc/boto.cfg file
[Credentials]
aws_access_key_id = 'id'
aws_secret_access_key = 'key'
[s3]
region='ap-south-1'
aws_access_key_id ='id'
aws_secret_access_key = 'key'
What is the issue with this? Why am I not able to access the bucket?