This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import boto3 | |
import json | |
def respond(res): | |
return { | |
'statusCode': '200', | |
'body': json.dumps(res), | |
'headers': { | |
'Content-Type': 'application/json', | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. SHOW ALL DATABASES | |
show dbs | |
2. SHOW CURRENT DATABASE | |
db | |
3. CREATE DATABASE | |
use transactions | |
4. CREATE COLLECTION / TABLE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Lets Learn Redis! | |
// **** PreRequisites **** | |
// Have Reddis running on localhost, either by using docker or installing it directly on your machine | |
const redis = require("redis"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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!"); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ECR | |
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Sid": "VisualEditor0", | |
"Effect": "Allow", | |
"Action": "ecr:*", | |
"Resource": "*" | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AWSTemplateFormatVersion: 2010-09-09 | |
Resources: | |
OrdersTable: | |
Type: AWS::DynamoDB::Table | |
Properties: | |
TableName: AuthorsTable_prod | |
AttributeDefinitions: | |
- AttributeName: "AuthorName" | |
AttributeType: "S" | |
- AttributeName: "BookTitle" |
OlderNewer