Member-only story
Configure AWS S3 With Django
2 min readFeb 15, 2023
Amazon S3 (Simple Storage Service) is a highly scalable, object-based cloud storage service provided by Amazon Web Services (AWS). It allows users to store and retrieve any amount of data from anywhere on the web.
To configure Amazon S3 to store your Django project’s static and media files, you can follow these steps:
- Create an S3 bucket: Log in to the Amazon S3 management console, click on “Create Bucket,” and follow the steps to create a new bucket.
- Set up an IAM user: You need to create an IAM (Identity and Access Management) user that has permission to access your S3 bucket. Go to the IAM management console, click on “Users,” and then “Add user.” Give the user a name and select the “Programmatic access” option. Attach the “AmazonS3FullAccess” policy to the user, and then create the user.
- Store your AWS credentials: You need to store your AWS access key ID and secret access key somewhere safe, so that your Django application can access your S3 bucket. You can store these credentials in the
settings.py
file of your Django project. - Install the boto3 library: You’ll need to install the boto3 library in order to interact with S3 from your Django project. You can install it using pip:
pip install boto3