If you need to get the current Account Number, or Account ID from within a Lambda execution, then you can access invoked_function_arn from the context and return the associated value as follows:

1
aws_account_id = context.invoked_function_arn.split(":")[4]