Bash script to wrap the popular AWS utility and allowing the use of EC2 assigned IAM role permissions.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

S3 Curl tool with IAM role support

Bash script to wrap the AWS utility allowing access to S3 buckets via an EC2 assigned IAM role (instance profile).

Upon first call will automatically fetch required IAM role credentials from the endpoint and generate a ~/.s3curl config for use by which includes the IAM instance profile access token used by

Install & usage

# example placement of scripts somewhere public
$ curl -s | tar -xz
$ ./ -s

Executing via CloudInit / user-data

If calling the script via EC2 user-data (I would think this is a common scenario), you will find (with Ubuntu AMI images at least) that the $HOME environment variable will not be defined this early in the instances bootstrap which will cause issues with both and

Since user-data executes as root, you can combat this by placing the following lines at the start of your user-data scripts:

#!/bin/bash -e

# setting $HOME since not available yet when run via CloudInit
export HOME