Created
March 17, 2016 12:06
-
-
Save fiunchinho/70a5d53198e25df65ca6 to your computer and use it in GitHub Desktop.
Python script to fetch AWS access key and secret key from a running EC2 instance
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from botocore.credentials import InstanceMetadataProvider, InstanceMetadataFetcher | |
provider = InstanceMetadataProvider(iam_role_fetcher=InstanceMetadataFetcher(timeout=1000, num_attempts=2)) | |
credentials = provider.load() | |
access_key = credentials.access_key | |
secret_key = credentials.secret_key | |
print access_key | |
print secret_key |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment