test-kitchen/kitchen-ec2 — pull request #33 by anthroprose (2014-01-16 01:27:31+00:00)
Title: Added User Data option for running scripts to install dependencies or artifacts before chef runs or kitchen-ec2 provisions.

I needed to get an encrypted data bag on-box before chef-zero ran, this is how I did it:

```yaml
user_data: ./user-data.sh
```

```bash
#!/bin/bash

########## Echo a small python script to download S3 Artifacts ##########
echo "#!/usr/bin/python
import boto
from boto.s3.connection import S3Connection
s3 = S3Connection()
bucket = s3.get_bucket('jumpshot-repository-cloud')
key = bucket.get_key('chef/encrypted_data_bag_secret')
key.get_contents_to_filename('/etc/chef/.secret')" >> /tmp/secrets.py

########## Install Python/Boto and run the script #######################
sudo yum install python python-boto
python /tmp/secrets.py
```