Skip to content

Instantly share code, notes, and snippets.

@aws-scripting-guy
Created March 6, 2016 23:49
Show Gist options
  • Save aws-scripting-guy/83d901527fa7adc271da to your computer and use it in GitHub Desktop.
Save aws-scripting-guy/83d901527fa7adc271da to your computer and use it in GitHub Desktop.

Revisions

  1. aws-scripting-guy created this gist Mar 6, 2016.
    10 changes: 10 additions & 0 deletions get_account_id_lambda.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    def lambda_handler(event, context):

    # Get Account Id from lambda function arn
    print "lambda arn: " + context.invoked_function_arn

    # Get Account ID from lambda function arn in the context
    ACCOUNT_ID = context.invoked_function_arn.split(":")[4]
    print "Account ID=" + ACCOUNT_ID