AWS SDK for Python (Boto3) development in Visual Studio 2017

Here are the steps to access AWS S3 using Python in Visual Studio 2017.

environment

Windows 7 Professional SP1 64bit Visual Studio 2017 Community 15.2 (26430.6) Python 3.6.0 boto3 1.4.4

Please refer to here for environment construction and Python project creation. http://qiita.com/akabei/items/a3b8b62f1cf34b683121

Project creation

Create a "Python application" in your new project.

aaa.png

boto3 package installation

From your project's Python environment, right-click Python 3.6 (64bit) (global default) and select Install Python Package ...

bbb.png

Enter "boto3" in the text box and select "Install boto3 (1.4.4)".

ccc.png

When the dialog that requires administrator privileges is displayed, select "Promote Now".

ddd.png

After installing the package, "boto3 (1.4.4)" will be displayed in "Python 3.6 (64bit) (global default)".

eee.png

S3 bucket list display

Write a program to display the S3 bucket list in s3bucket.py.

s3bucket.py


import boto3

session = boto3.Session(aws_access_key_id='XXXXXXXXXXXXXXXXXX',
                        aws_secret_access_key='YYYYYYYYYYYYYYYYYYYYYYYYYYYY',
                        region_name='ap-northeast-1')

s3 = session.resource('s3')
for bucket in s3.buckets.all():
    print(bucket.name)

If you have set the authentication information with the aws configure command in advance, boto3.Session () is unnecessary as shown below.

s3bucket.py


import boto3

s3 = boto3.resource('s3')
for bucket in s3.buckets.all():
    print(bucket.name)

If you can execute it and get the bucket list, you are done.

Recommended Posts

AWS SDK for Python (Boto3) development in Visual Studio 2017
Python development in Visual Studio 2017
Python development in Visual Studio
boto3 (AWS SDK for Python) Note
Settings for Python coding in Visual Studio Code
Use Resource API rather than Client API in AWS SDK for Python (Boto3)
Authentication information used by Boto3 (AWS SDK for Python)
App development to tweet in Python from Visual Studio 2017
Use AWS SDK for Python (boto) under Proxy environment
Python Tools for Visual Studio Installation Guide
Run Python in C ++ on Visual Studio 2017
A memo for those who use Python in Visual Studio (me)
[Cloudian # 1] Try to access object storage with AWS SDK for Python (boto3)
Build Python development environment with Visual Studio Code
Django with Python Tools 2.2 for Visual Studio (PTVS 2.2)
Call Polly from the AWS SDK for Python
[Visual Studio Code] [Python] Tasks.json + problemMatcher settings for Python
Framework development in Python
Development environment in Python
Slackbot development in Python
Create a Python development environment in 10 minutes (Mac OS X + Visual Studio Code)
Steps to put dlib in Python Tools for Visual Studio and have fun
Directory structure for test-driven development using pytest in python
Fleet provisioning with AWS IoT SDK for Python v2
Make Visual Studio Code autocomplete for python external libraries
Python development environment with Windows + Anaconda3 + Visual Studio Code
Python development environment with Windows + Python + PipEnv + Visual Studio Code
Japanese output when dealing with python in visual studio
Install numpy in Visual Studio 2019
[Python] Scraping in AWS Lambda
Bottle Pug in Visual studio 2019
[For organizing] Python development environment
About "for _ in range ():" in python
Run AWS IoT Device SDK for Python on Raspberry Pi
Set up a Python development environment with Visual Studio Code
How to debug the Python standard library in Visual Studio
Enable the virtualenv Python virtual environment for Visual Studio Code
Building a development environment for Android apps-creating Android apps in Python
Do something like a Python interpreter in Visual Studio Code
Build Python3 for Windows 10 on ARM with Visual Studio 2019 (x86) on Windows 10 on ARM
[Visual Studio Code] [Python] [Windows] Support for garbled Japanese characters in Python in VS Code task / debug output
Check for memory leaks in Python
Check for external commands in python
Learning history for participating in team application development in Python ~ Index page ~
Learning history for participating in team app development in Python ~ Django Tutorial 4 ~
Web application development memo in python
Write AWS Lambda function in Python
Bash, Python, Javascript, code command, etc. in Visual Studio Code on Mac
Learning history for participating in team app development in Python ~ Django Tutorial 1, 2, 3 ~
Best practice for logging in JSON format on AWS Lambda / Python
Python development environment options for May 2020
Emacs settings for Python development environment
Learning history for participating in team app development in Python ~ Django Tutorial 6 ~
AWS Layer Creation Script for python
Remote debugging in Visual Studio (Linux)
Learning history for participating in team app development in Python ~ Django Tutorial 7 ~
Run unittests in Python (for beginners)
How to hide the command prompt when running python in visual studio 2015
(For myself) Flask_AWS_1 (Install PHP, MySQL, phpMyAdmin, Python in AWS virtual environment)
Create a Python development environment on Windows (Visual Studio Code remote WSL).
Procedure from AWS CDK (Python) development to AWS resource construction * For beginners of development