Help us understand the problem. What is going on with this article?

AWS S3 sample python project

More than 1 year has passed since last update.

Sample adding image in AWS S3 with python

we will use Boto3 which is the Amazon Web Services (AWS) SDK for Python which allows Python developers to write software that makes use of Amazon services like S3 and EC2. Boto provides an easy to use, object-oriented API as well as low-level direct service access.

Installation
pip install boto3

SAMPLE CODE

import boto3
from botocore.client import Config

ACCESS_KEY_ID = 'your_key_id'
ACCESS_SECRET_KEY = 'your_secret_key'
BUCKET_NAME = 'your_bucket_name'

data = open('test.png', 'rb')

s3 = boto3.resource(
    's3',
    aws_access_key_id=ACCESS_KEY_ID,
    aws_secret_access_key=ACCESS_SECRET_KEY,
    config=Config(signature_version='s3v4')
)

s3.Bucket(BUCKET_NAME).put_object(Key='test.png', Body=data)

print ("Done")
phansreypich
Software Engineering student but funny, Like travelling, eating, making friends, technology, I can speak Japanese a little bit. I went to Japan once this year.
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした