Skip to content

Instantly share code, notes, and snippets.

@w3iBStime
w3iBStime / DeriveSesSmtpPassword.py
Last active August 10, 2018 04:57
Python script to derive AWS SES SMTP passwords from IAM access secret keys using HMAC, SHA256 and Base64 per http://docs.aws.amazon.com/ses/latest/DeveloperGuide/smtp-credentials.html
import base64
import hmac
import hashlib
secret = "_____" # replace with the secret key to be hashed
message = "SendRawEmail"
sig_bytes = bytearray(b'\x02') # init with version
theHmac = hmac.new(secret.encode("ASCII"), message.encode("ASCII"), hashlib.sha256)
@gene1wood
gene1wood / example_aws_lambda_cloudformation_context.md
Last active October 21, 2024 12:48
Details on the AWS Lambda Python LambdaContext context object when instantiated from a CloudFormation stack

LambdaContext

Here is the raw output from examining the Python LambdaContext context object in a AWS Lambda function when called from a CloudFormation stack. More information on the context object can be found here : http://docs.aws.amazon.com/lambda/latest/dg/python-context-object.html

LambdaContext object : print(context)

<__main__.LambdaContext object at 0x7fd706780710>

LambdaContext vars : vars(context)