Skip to content

Instantly share code, notes, and snippets.

View ggworld's full-sized avatar

Menachem Geva ggworld

View GitHub Profile
@wjimenez5271
wjimenez5271 / read_aws_credentials.py
Created January 13, 2016 22:54
Simple python 2.7 implementation of a config reader for ~/.aws/credentials file
def get_profile_credentials(profile_name):
from ConfigParser import ConfigParser
from ConfigParser import ParsingError
from ConfigParser import NoOptionError
from ConfigParser import NoSectionError
from os import path
config = ConfigParser()
config.read([path.join(path.expanduser("~"),'.aws/credentials')])
try:
aws_access_key_id = config.get(profile_name, 'aws_access_key_id')