Skip to content

Instantly share code, notes, and snippets.

import boto3
import json
def respond(res):
return {
'statusCode': '200',
'body': json.dumps(res),
'headers': {
'Content-Type': 'application/json',
},
#IAM Permission needed: dynamodb:query
import json
import sys
import boto3
from boto3.dynamodb.conditions import Key, Attr
dynamodb = boto3.resource('dynamodb')
def lambda_handler(event, context):
1. SHOW ALL DATABASES
show dbs
2. SHOW CURRENT DATABASE
db
3. CREATE DATABASE
use transactions
4. CREATE COLLECTION / TABLE
//Lets Learn Redis!
// **** PreRequisites ****
// Have Reddis running on localhost, either by using docker or installing it directly on your machine
const redis = require("redis");
Docker Notes
---
docker daemon
REST Api to interact with it
CLI to interact with it uses the REST APIs
your docker daemon can run on a totally different machine and you can issue commands to it from your local
'dockerd' = daemon
'docker' = using the api
Docker Orchestration
----
Kubernetes
---
Takes declared state, and works to make that happen across a cluster.
Node - 'kubelet' runs pods and talks 2 master. Node = Computer
Pod - runs 1+ containers, exists on node
Service - handles requests using LB
NodeJS
---
Every file is a 'module'
console.log(`Hi ${this.name}!`); <-- `` Templating
Make sure to use the relative path when importing or node will think you are using the built in module
exports.sayHello = function() {
console.log("Hello!");
};
ECR
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": "ecr:*",
"Resource": "*"
},
Commands
------------
1. Build Docker Image
docker build -t test .
2. Run container /w image
docker run -d --publish 8888:5000 test
3. Login to ECR
aws ecr get-login-password --region REGIONHERE!!!! | docker login --username AWS --password-stdin ACCOUNTIDHERE!!!!.dkr.ecr.REGIONHERE!!!.amazonaws.com
AWSTemplateFormatVersion: 2010-09-09
Resources:
OrdersTable:
Type: AWS::DynamoDB::Table
Properties:
TableName: AuthorsTable_prod
AttributeDefinitions:
- AttributeName: "AuthorName"
AttributeType: "S"
- AttributeName: "BookTitle"