Opération S3 avec python boto3

Installation

Installez boto3 avec pip ou quelque chose. Installez en utilisant conda.

$ conda install -c anaconda boto3=1.3.1

Enregistrer les informations d'identification et la région par défaut à l'aide d'AWS CLI

$ aws configure
aws_access_key_id = ACCESS_KEY_ID
aws_secret_access_key = SECRET_ACCESS_KEY
region = ap-northeast-1
output = json

De plus, c'est ok même si vous l'ajoutez directement au fichier comme indiqué ci-dessous

$ vim ~/.aws/credentials
[default]
aws_access_key_id = ACCESS_KEY_ID
aws_secret_access_key = SECRET_ACCESS_KEY
$ vim ~/.aws/config:
[default]
region = ap-norteast-1
output = json

Obtenir la liste des seaux

import boto3

s3 = boto3.resource('s3')

for bucket in s3.buckets.all():
    print(bucket.name)

télécharger

import boto3

s3 = boto3.resource('s3')

data = open('test.jpg', 'rb')
s3.Bucket('my-bucket').put_object(Key='test.jpg', Body=data)

Ci-dessous, référence http://boto3.readthedocs.io/en/latest/index.html

Recommended Posts

Opération S3 avec python boto3
Téléchargeur S3 avec boto
Chiffrement côté serveur S3 SSE avec Python boto3
[Python] Résumé des opérations sur les fichiers S3 avec boto3
[S3] CRUD avec S3 utilisant Python [Python]
[Automatisé avec python! ] Partie 2: Fonctionnement des fichiers
Utilisez boto3 pour accéder à S3
Générer une URL signée S3 avec boto
FizzBuzz en Python3
Grattage avec Python
Statistiques avec python
[python] Opération vectorielle
Grattage avec Python
Python avec Go
Twilio avec Python
Intégrer avec Python
Jouez avec 2016-Python
AES256 avec python
Testé avec Python
Fonctionnement du système d'exploitation Python
Essayez le chiffrement côté serveur de S3 à l'aide de boto3
python commence par ()
avec syntaxe (Python)
Premiers pas avec Dynamo de Python boto
[AWS] Associez Lambda et S3 à boto3
Bingo avec python
[Python] Opération de matrice
Zundokokiyoshi avec python
Connectez-vous à s3 avec AWS Lambda Python
Excel avec Python
Micro-ordinateur avec Python
Cast avec python
Comment gérer l'erreur SSL lors de la connexion à S3 avec Python boto
Copier des données d'Amazon S3 vers Google Cloud Storage avec Python (boto)
Fonctionnement automatique de Chrome avec Python + Sélénium + pandas
Gérez bien AWS avec la bibliothèque Python Boto
Exporter un instantané RDS vers S3 avec Lambda (Python)
Communication série avec Python
Zip, décompressez avec python
Django 1.11 a démarré avec Python3.6
Jugement des nombres premiers avec Python
Python avec eclipse + PyDev.
Communication de socket avec Python
Analyse de données avec python 2
[Python] Opération d'énumération
Grattage en Python (préparation)
Essayez de gratter avec Python.
Apprendre Python avec ChemTHEATER 03
Recherche séquentielle avec Python
"Orienté objet" appris avec python
Exécutez Python avec VBA
Manipuler yaml avec python
Résolvez AtCoder 167 avec python
Communication série avec python
[Python] Utiliser JSON avec Python
Apprendre Python avec ChemTHEATER 05-1
Apprenez Python avec ChemTHEATER
[Python] 2 conversion du complément
1.1 Premiers pas avec Python
Binarisation avec OpenCV / Python
3. 3. Programmation IA avec Python