Using Pythonista and Boto3

Eden Hare
4 min readOct 12, 2020

The Apple iPhone and iPad have this wonderful Python development environment called Pythonista. If you can import a module using the Pythonista StaSh extension, then you can get working with boto3 in Pythonista.

However, boto3 requires your AWS credentials to be configured either in a shared credentials file, in environment variables, or specified when the boto3 session, resource, or client is created.

Working with Pythonista requires some degree of creativity when dealing with issues like this one. However, there is no reason why you can’t get the same shared credentials file you use on other computing devices onto your iPad for use with Pythonista. Let’s look at how to do this.

Get and Launch StaSh

StaSh is a bash-like implementation that can run within Pythonista. There have been many improvements since its first release. To get and install StaSh, launch Pythonista and in the interactive console, execute the command

import requests as r; exec(r.get('http://bit.ly/get-stash').text)

The command downloads StaSh allowing you to execute it like any other python tool. Once installed, find the launch_stash.py file and run it. This results in a console window where you can interact with the shell.

Install boto3

Once StaSh is running, you can expand the console view and display the StaSh window.

--

--

Eden Hare

Eden is the co-author of seven books and author of more than 100 articles and book chapters in technical, management, and information security publications.