#!/usr/bin/env python
# Reads a profile from ~/.aws/config and calls the command with
# AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY set correctly.
import ConfigParser
import os
import subprocess
import sys

c = ConfigParser.SafeConfigParser()
c.read(os.path.expanduser('~/.aws/config'))

section = sys.argv[1]
cmd = sys.argv[2:]

if section != 'default':
    section = 'profile %s' % section

os.environ['AWS_ACCESS_KEY_ID'] = c.get(section, 'aws_access_key_id')
os.environ['AWS_SECRET_ACCESS_KEY'] = c.get(section, 'aws_secret_access_key')
print os.environ['AWS_ACCESS_KEY_ID']
subprocess.call(' '.join(cmd), shell=True)

@@ -271,21 +271,26 @@
 ~/.aws/c
-onfig
+redentials
 '))%0A%0Asec
@@ -328,16 +328,17 @@
 gv%5B2:%5D%0A%0A
+#
 if secti
@@ -354,16 +354,17 @@
 fault':%0A
+#
     sect

Fix profile script to correctly use the credentials file