Last active
June 18, 2016 00:39
-
-
Save dagrz/9b006d116302ba9dc4a1234b867c30c7 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env python | |
from __future__ import print_function | |
import awscli | |
import awscli.clidriver | |
from cStringIO import StringIO | |
import sys | |
import json | |
def lambda_handler(event, context): | |
old_stdout = sys.stdout | |
sys.stdout = mystdout = StringIO() | |
driver = awscli.clidriver.create_clidriver() | |
driver.main(args=event["command"]) | |
sys.stdout = old_stdout | |
return json.loads(mystdout.getvalue()) | |
if __name__ == '__main__': | |
event = { | |
"command": [ | |
"sts", | |
"get-caller-identity" | |
] | |
} | |
print(lambda_handler(event, None)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment