Skip to content

Instantly share code, notes, and snippets.

@OndeVai
Last active November 27, 2018 04:52
Show Gist options
  • Save OndeVai/3477c1677492f711843957ec02b7b0e7 to your computer and use it in GitHub Desktop.
Save OndeVai/3477c1677492f711843957ec02b7b0e7 to your computer and use it in GitHub Desktop.
aws-samples
//cli
//cognito
--create a user
aws cognito-idp sign-up \
--region REGION \
--client-id APP_CLIENTID \
--username APPUSERNAME/EMAIL \
--password PASSWORD
--confirm a user
aws cognito-idp admin-confirm-sign-up \
--region REGION \
--user-pool-id USERPOOLID \
--username APPUSERNAME/EMAIL \
//upload file to s3
aws s3 cp my-lambda-package.zip s3://artifacts-for-lambda-ronin-test
//SAM
//--package app
aws cloudformation package --template-file sam-template.yaml --s3-bucket artifacts-for-lambda-ronin-test --output-template-file sam-output-template.yaml
--or same using "sam package..."
//--deploy app (use the resulting output file)
aws cloudformation deploy --template-file sam-output-template.yaml --stack-name my-serverless-app --capabilities CAPABILITY_IAM
--or same using "sam deploy..."
//--delete the stack
aws cloudformation delete-stack --stack-name my-serverless-app
//--validate yaml
sam validate --template sam-template.yaml
//--test api locally (doesn't work for dynamo etc??)
sam local start-api -t sam-template.yaml
//--invoke lambda locally
sam local invoke MyLambdaFunction -t sam-template.yaml --event ./src/testevent.json
//--invoke events locally (see docs and --help)
same local generate-event [service]
//dynamo -
//modelling
--partition key
--sort key
--primary key is unique and is partition key or partition key + sort key if sort key defined
//RCU (Read Capacity Unit)
4kb/second of data (for strongly consistent)
8kb/second (for eventually consistent)
//WCU (Write Capacity Unit)
5kb/second of data (double check?)
//Formulas
RCU - [item size]/4kb (rounded up) (for strongly consistent) (i.e. 8kb would be 2 RCUs)
RCU - ([item size]/4kb)/2 (rounded up) (for strongly consistent) (i.e. 8kb would be 1 RCUs)
//Node Api
putItem - inserts or replaces an item
updateItem - for field-level updates
getItem - gets one by primary key
query - queries on partition and/or sort key, allows for additional filters and sorting on sort key, this is querying within partition
scan - queries on all items, most costly because it ignores partitions
deleteItem - delete item
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment