-
-
Save iTrauco/aa3ac78645d227f22cee5218b09a87fa 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 hidden or 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