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.
At this point, run pip install boto3
, assuming Python3, which is then nicely installed into the correct location in the Pythonista installation. All we have to do now is set up the credentials.
Create the Credential and Config Files
Unfortunately, I haven’t been able to get the AWS CLI running within Pythonista, even though it is a Python application. That doesn’t mean all is lost, however. From within Pythonista, create a config file. Here is an example:
[default]
region = us-east-1
[preview]
sdb = true
These options set the default region AWS commands are executed against unless a different region is chosen. The [preview] section allows using the sdb service which is in preview mode in the CLI.