Hello!
The easiest way to definitely do this is to create a bash script primarily. This script needs to contain your installation commands.
Later, you need to copy it to the S3 and set up a bootstrap action to point to the script (This is done from the console)
Consider the following example:
#!/bin/bash -xe
# Non-standard and non-Amazon Machine Image Python modules:
sudo pip install -U \
awscli \
boto \
ciso8601 \
ujson \
workalendar
sudo yum install -y python-psycopg2
Hope this helped!