Flask & Boto3 `ValueError: Required parameter name not set` on Accessing Resource Flask & Boto3 `ValueError: Required parameter name not set` on Accessing Resource flask flask

Flask & Boto3 `ValueError: Required parameter name not set` on Accessing Resource


Boto3 allows 3 ways to set credentials, documented here.

It looks like you are using the 3rd method, linked above, of Method Parameters here:

s3 = boto3.client(    "s3",    aws_access_key_id=S3_KEY,    aws_secret_access_key=S3_SECRET)

The problem is, you aren't using the s3 variable (storing the boto3 client) to access your resource. This method creates a "low-level client", meant for very specific access to your S3 resources. So if that is your intention, read the docs on the Client class here.

Otherwise, you can have Boto read from environment variables, like in this method here, and then go about accessing your resource as you are doing above.

You'll have to set the following environment variables, likely in your ~/.bash_profile on localhost, so boto3 knows how to connect to your AWS S3 Bucket. In your ~/.bash_profile, add:

export AWS_ACCESS_KEY_ID="The access key for your AWS account."export AWS_SECRET_ACCESS_KEY="The secret key for your AWS account."export AWS_SESSION_TOKEN="The session key for your AWS account."# This is only needed when you are using temporary credentials, so you can probably ignore it!

After editing this file, save it, and run a source ~/.bash_profile to export your new env variables into your environment (in the same shell that you're starting your server in), and start your server.