-
Copy the
generate.py
script to your machine. -
Update the
BUCKET_NAME
andKEY_NAME
values in the script as needed. -
Run
python generate.py
. It will spit some output like the following:
$ python3 generate.py
function dsql { | |
local auth_token | |
auth_token=$(aws dsql generate-db-connect-admin-auth-token \ | |
--region us-east-1 \ | |
--expires-in 3600 \ | |
--hostname CLUSTER_ENDPOINT_URL) || { echo "Failed to generate auth token" >&2; return 1; } | |
if [ -z "$auth_token" ]; then | |
echo "Auth token is empty" >&2 | |
return 1 |
functions: | |
hello: | |
handler: handler.hello | |
events: | |
- http: | |
path: hello | |
method: get | |
cors: | |
origin: 'api.myorigin.com' | |
headers: |
# handler.js | |
const middy = require('middy') | |
const { cors } = require('middy/middlewares') | |
// This is your common handler, no way different than what you are used to do every day | |
// in AWS Lambda | |
const processPayment = (event, context, callback) => { | |
// we don't need to deserialize the body ourself as a middleware will be used to do that | |
const { creditCardNumber, expiryMonth, expiryYear, cvc, nameOnCard, amount } = event.body |