Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Week8 #20

Open
wants to merge 89 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
89 commits
Select commit Hold shift + click to select a range
b05d2bc
week0
papicool Mar 3, 2023
ddbaf01
qdd budget files
papicool Mar 3, 2023
df03cac
cli commands for billing and budget alarm
papicool Mar 4, 2023
752fecc
add screenshot folder
papicool Mar 4, 2023
5c15f56
Delete file
papicool Mar 4, 2023
5e7a2f4
add changes
papicool Mar 4, 2023
0ce1485
Merge branch 'main' of https://github.com/papicool/aws-bootcamp-crudd…
papicool Mar 4, 2023
4d9ff4c
Add files via upload
papicool Mar 4, 2023
1fca794
Delete week0.md
papicool Mar 4, 2023
0179694
Update week0.md
papicool Mar 4, 2023
00b4d95
Update week0.md
papicool Mar 4, 2023
a9bc699
Update week0.md
papicool Mar 4, 2023
4170a8a
Update week0.md
papicool Mar 4, 2023
86c6bf2
Add files via upload
papicool Mar 4, 2023
62ee26d
add dockerfile
papicool Mar 6, 2023
165a709
update dockerfile
papicool Mar 6, 2023
e422be8
week1
papicool Mar 6, 2023
7b99af3
Update week1.md
papicool Mar 6, 2023
8177728
Update week1.md
papicool Mar 6, 2023
18bbf75
Update week1.md
papicool Mar 6, 2023
e0f7cf2
Update week1.md
papicool Mar 6, 2023
c82fc12
Add files via upload
papicool Mar 6, 2023
8cfc00f
Update week1.md
papicool Mar 6, 2023
b193877
updated
papicool Mar 6, 2023
bbe3037
update the open api file to add notifications
papicool Mar 7, 2023
812652c
create a new notifications backend endpoint
papicool Mar 7, 2023
32fd0db
implement frontend notifications page
papicool Mar 7, 2023
017d09a
install postgres and docker
papicool Mar 7, 2023
8ff822b
instrument HoneyComb
papicool Mar 8, 2023
a98c143
implement Honeycomb and add tracer, attributes
papicool Mar 8, 2023
46de277
Update week2.md
papicool Mar 13, 2023
da820ed
install xray
papicool Mar 13, 2023
1e658a6
instrument xray
papicool Mar 13, 2023
cb387db
instument xray updates
papicool Mar 13, 2023
e9757b1
updates instrument AWS XRAY
papicool Mar 15, 2023
9aea920
updates intrument AWS Xray
papicool Mar 15, 2023
e7196ea
comment implementation cloudwatch logs and xray implementation
papicool Mar 15, 2023
e0d88f5
instrument rollbar
papicool Mar 15, 2023
6f50dc1
finish implementing rollbar
papicool Mar 15, 2023
bff798c
Update README.md
papicool Mar 15, 2023
44935eb
Update week3.md
papicool Mar 15, 2023
bdac5ea
integrate AWS Cognito
papicool Mar 15, 2023
982c09a
update amplify configuration
papicool Mar 15, 2023
8d13cb5
Setup Cognito User Pool and Implement Custom Signin Page
papicool Mar 15, 2023
e1b8cc1
Implement Custom Signin, Signup and Confirmation Pages
papicool Mar 16, 2023
6cd8eae
update Recovery Page and add logs
papicool Mar 16, 2023
815306f
implement and Verify backend JWT token server side
papicool Mar 18, 2023
f92aee3
Update README.md
papicool Mar 18, 2023
cb90005
Update week4.md
papicool Mar 18, 2023
f30bdad
add devcontainer json file
papicool Mar 18, 2023
69a53c8
Update devcontainer.json
papicool Mar 18, 2023
24627c0
add dark theme
papicool Mar 18, 2023
2c16c8a
codespace config setup
papicool Mar 20, 2023
8ab9863
add env vars to devcontainer
papicool Mar 20, 2023
ecf606b
bash commands for psql
papicool Mar 20, 2023
ffb2640
bash commands for psql
papicool Mar 20, 2023
c7be3ac
add postgres lib and requirements
papicool Mar 21, 2023
670a293
implement home queries working
papicool Mar 21, 2023
d7d8fbb
implement inbound rule and connect to prod db
papicool Mar 21, 2023
2cb5456
update bin scripts files
papicool Mar 21, 2023
d45338c
post confirmation lambda
papicool Mar 22, 2023
6844720
refector db calls
papicool Mar 23, 2023
62c7a4d
bascule to gitpod
papicool Mar 27, 2023
294d00a
create activities and update display_name
papicool Mar 29, 2023
6d11348
create activities
papicool Mar 30, 2023
5d21553
Update README.md
papicool Apr 3, 2023
7e16adf
Update week5.md
papicool Apr 5, 2023
88a9e66
structuring bash commands
papicool Apr 9, 2023
aff7344
Implement Schema Load, Seed, Scan Scripts and Pattern Scripts for Rea…
papicool Apr 9, 2023
d1df7e2
update drop script et gitpod config
papicool Apr 10, 2023
411ce99
implement Listing Messages Group into Application and update sql scripts
papicool Apr 13, 2023
07753d9
Update .gitpod.yml
papicool Apr 13, 2023
a97bba9
Updating a Message Group using DynamoDB Streams
papicool Apr 13, 2023
4ba9681
Update README.md
papicool Apr 13, 2023
7dd0da4
Update README.md
papicool Apr 13, 2023
dc11514
deploying backend container
papicool May 9, 2023
32e1116
implement refresh token and modify some bash scripts
papicool May 16, 2023
0011d9e
Refactor bin directory
papicool May 16, 2023
60145d3
update bash scripts
papicool May 18, 2023
f5a91b6
generate env vars - handle xray - improve bash scripts
papicool May 18, 2023
72e0a4e
implement serverless image Process with CDK
papicool May 22, 2023
dd2f464
serving avatars via cloudfront
papicool May 22, 2023
80d3464
implement users profile page
papicool May 24, 2023
d7f9276
make sure to print out stuff when we want to print for flask for deve…
papicool May 24, 2023
e220e4b
attempt to setup scripts on launch such as login into ecr
papicool May 24, 2023
e319173
change bootstrap to login to ecr and generate env vars
papicool May 24, 2023
f700bc9
Implement Migrations Backend Endpoint and Profile Form
papicool May 31, 2023
b00e9b6
Fix CORS Final AWS Lambda Layers
papicool Jun 1, 2023
fc3c8c5
Render Avatars in App via CloudFront
papicool Jun 3, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/docker-existing-docker-compose
{
"name": "Cruddur Configuration",
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
// Features to add to the dev container. More info: https://containers.dev/features.
"features": {
"ghcr.io/devcontainers/features/aws-cli:1": {}
},
"remoteEnv": {
"AWS_CLI_AUTO_PROMPT": "on-partial"
},
"customizations": {
"vscode": {
"extensions": [
"ms-azuretools.vscode-docker",
"ms-python.python",
"dracula-theme.theme-dracula"
],
"settings": {
"workbench.colorThe": "Default Dark+ Experimental"
}
}
}

// "features": {},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],


// Configure tool-specific properties.
// "customizations": {},

// Uncomment to connect as an existing user other than the container default. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "devcontainer"
}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
frontend-react-js/build/*
node_modules
*.env
docker/**/*
59 changes: 58 additions & 1 deletion .gitpod.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,61 @@
tasks:
- name: aws-cli
env:
AWS_CLI_AUTO_PROMPT: on-partial
before: |
cd /workspace
rm -rf aws awscliv2.zip
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install
cd $THEIA_WORKSPACE_ROOT
bash bin/ecr/login
- name: postgres
before: |
curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc|sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/postgresql.gpg
echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" |sudo tee /etc/apt/sources.list.d/pgdg.list
sudo apt update
sudo apt install -y postgresql-client-13 libpq-dev
command: |
export GITPOD_IP=$(curl ifconfig.me)
source "$THEIA_WORKSPACE_ROOT/backend-flask/bin/rds/update-sg-rule"
- name: react-js
command: |
ruby $THEIA_WORKSPACE_ROOT/bin/frontend/generate-env
cd frontend-react-js
npm i
- name: backend-flask
command: |
ruby $THEIA_WORKSPACE_ROOT/bin/backend/generate-env
cd backend-flask
pip install -r requirements.txt
- name: fargate
command: |
curl "https://s3.amazonaws.com/session-manager-downloads/plugin/latest/ubuntu_64bit/session-manager-plugin.deb" -o "session-manager-plugin.deb"
sudo dpkg -i session-manager-plugin.deb
cd backend-flask
- name: cdk
before: |
npm install aws-cdk -g
cd thumbing-serverless-cdk
npm i

vscode:
extensions:
- 42Crunch.vscode-openapi
- 42Crunch.vscode-openapi
- cweijan.vscode-postgresql-client2
- ms-python.python

- rangav.vscode-thunder-client

ports:
- name: frontend
port: 3000
onOpen: open-browser
visibility: public
- name: backend
port: 4567
visibility: public
- name: xray-daemon
port: 2000
visibility: public
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ At the start of the bootcamp you need to create a new Github Repository from thi

The `/journal` directory contains

- [ ] [Week 0](journal/week0.md)
- [ ] [Week 1](journal/week1.md)
- [ ] [Week 2](journal/week2.md)
- [ ] [Week 3](journal/week3.md)
- [ ] [Week 4](journal/week4.md)
- [ ] [Week 5](journal/week5.md)
- [ ] [Week 6](journal/week6.md)
- [ ] [Week 7](journal/week7.md)
- [ ] [Week 8](journal/week8.md)
- [ ] [Week 9](journal/week9.md)
- [ ] [Week 10](journal/week10.md)
- [ ] [Week 11](journal/week11.md)
- [ ] [Week 12](journal/week12.md)
- [ ] [Week 13](journal/week13.md)
- [x] [Week 0 - Billing and Architecture](journal/week0.md)
- [x] [Week 1 - App Containerization](journal/week1.md)
- [x] [Week 2 - Distributed Tracing](journal/week2.md)
- [x] [Week 3 - Decentralized Authentication](journal/week3.md)
- [x] [Week 4 - Postgres and RDS](journal/week4.md)
- [x] [Week 5 - DynamoDB and Serverless Caching](journal/week5.md)
- [ ] [Week 6 - Deploying Containers](journal/week6.md)
- [ ] [Week 7 - Solving CORS with a Load Balancer and Custom Domain](journal/week7.md)
- [ ] [Week 8 - Serverless Image Processing](journal/week8.md)
- [ ] [Week 9 - CI/CD with CodePipeline, CodeBuild and CodeDeploy](journal/week9.md)
- [ ] [Week 10 - CloudFormation Part 1](journal/week10.md)
- [ ] [Week 11 - CloudFormation Part 2](journal/week11.md)
- [ ] [Week 12 - Modern APIs](journal/week12.md)
- [ ] [Week 13 - (Secret Bonus Class)](journal/week13.md)
86 changes: 86 additions & 0 deletions aws/backup_files/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
version: "3.8"
services:
backend-flask:
environment:
#AWS_ENDPOINT_URL: "http://dynamodb-local:8000"
#CONNECTION_URL: "postgresql://postgres:password@db:5432/cruddur"
CONNECTION_URL: "${PROD_CONNECTION_URL}"
PROD_CONNECTION_URL: "${PROD_CONNECTION_URL}"
#FRONTEND_URL: "https://${CODESPACE_NAME}-3000.${GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN}"
#BACKEND_URL: "https://${CODESPACE_NAME}-4567.${GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN}"
FRONTEND_URL: "https://3000-${GITPOD_WORKSPACE_ID}.${GITPOD_WORKSPACE_CLUSTER_HOST}"
BACKEND_URL: "https://4567-${GITPOD_WORKSPACE_ID}.${GITPOD_WORKSPACE_CLUSTER_HOST}"
OTEL_EXPORTER_OTLP_ENDPOINT: "https://api.honeycomb.io"
OTEL_EXPORTER_OTLP_HEADERS: "x-honeycomb-team=${HONEYCOMB_API_KEY}"
OTEL_SERVICE_NAME: "${HONEYCOMB_SERVICE_NAME}"
#AWS_XRAY_URL: "*${CODESPACE_NAME}-4567.${GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN}*"
AWS_XRAY_URL: "*4567-${GITPOD_WORKSPACE_ID}.${GITPOD_WORKSPACE_CLUSTER_HOST}*"
AWS_XRAY_DAEMON_ADDRESS: "xray-daemon:2000"
AWS_DEFAULT_REGION: "${AWS_DEFAULT_REGION}"
AWS_ACCESS_KEY_ID: "${AWS_ACCESS_KEY_ID}"
AWS_SECRET_ACCESS_KEY: "${AWS_SECRET_ACCESS_KEY}"
ROLLBAR_ACCESS_TOKEN: "${ROLLBAR_ACCESS_TOKEN}"
AWS_COGNITO_USER_POOL_ID: "us-east-1_fjE3ZCqqX"
AWS_COGNITO_USER_POOL_CLIENT_ID: "6ff7h7vbdua1rvjctbi7lode3l"
build: ./backend-flask
ports:
- "4567:4567"
volumes:
- ./backend-flask:/backend-flask
frontend-react-js:
environment:
REACT_APP_BACKEND_URL: "https://4567-${GITPOD_WORKSPACE_ID}.${GITPOD_WORKSPACE_CLUSTER_HOST}"
#REACT_APP_BACKEND_URL: "https://${CODESPACE_NAME}-4567.${GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN}"
REACT_APP_AWS_PROJECT_REGION: "${AWS_DEFAULT_REGION}"
REACT_APP_AWS_COGNITO_REGION: "${AWS_DEFAULT_REGION}"
REACT_APP_AWS_USER_POOLS_ID: "us-east-1_fjE3ZCqqX"
REACT_APP_CLIENT_ID: "6ff7h7vbdua1rvjctbi7lode3l"
REACT_APP_AWS_USER_POOLS_WEB_CLIENT_ID: "6ff7h7vbdua1rvjctbi7lode3l"
build: ./frontend-react-js
ports:
- "3000:3000"
volumes:
- ./frontend-react-js:/frontend-react-js
xray-daemon:
image: "amazon/aws-xray-daemon"
environment:
AWS_ACCESS_KEY_ID: "${AWS_ACCESS_KEY_ID}"
AWS_SECRET_ACCESS_KEY: "${AWS_SECRET_ACCESS_KEY}"
AWS_REGION: "us-east-1"
command:
- "xray -o -b xray-daemon:2000"
ports:
- 2000:2000/udp
db:
image: postgres:13-alpine
restart: always
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=password
ports:
- '5432:5432'
volumes:
- db:/var/lib/postgresql/data
dynamodb-local:
# https://stackoverflow.com/questions/67533058/persist-local-dynamodb-data-in-volumes-lack-permission-unable-to-open-databa
# We needed to add user:root to get this working.
user: root
command: "-jar DynamoDBLocal.jar -sharedDb -dbPath ./data"
image: "amazon/dynamodb-local:latest"
container_name: dynamodb-local
ports:
- "8000:8000"
volumes:
- "./docker/dynamodb:/home/dynamodblocal/data"
working_dir: /home/dynamodblocal

# the name flag is a hack to change the default prepend folder
# name when outputting the image names
networks:
internal-network:
driver: bridge
name: cruddur

volumes:
db:
driver: local
35 changes: 35 additions & 0 deletions aws/json/alarm_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"AlarmName": "DailyEstimatedCharges",
"AlarmDescription": "This alarm would be triggered if the daily estimated charges exceeds 1$",
"ActionsEnabled": true,
"AlarmActions": [
"arn:aws:sns:us-east-1:730331264766:billing-alarm"
],
"EvaluationPeriods": 1,
"DatapointsToAlarm": 1,
"Threshold": 1,
"ComparisonOperator": "GreaterThanOrEqualToThreshold",
"TreatMissingData": "breaching",
"Metrics": [{
"Id": "m1",
"MetricStat": {
"Metric": {
"Namespace": "AWS/Billing",
"MetricName": "EstimatedCharges",
"Dimensions": [{
"Name": "Currency",
"Value": "USD"
}]
},
"Period": 86400,
"Stat": "Maximum"
},
"ReturnData": false
},
{
"Id": "e1",
"Expression": "IF(RATE(m1)>0,RATE(m1)*86400,0)",
"Label": "DailyEstimatedCharges",
"ReturnData": true
}]
}
16 changes: 16 additions & 0 deletions aws/json/budget-notifications-with-subscribers.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[
{
"Notification": {
"ComparisonOperator": "GREATER_THAN",
"NotificationType": "ACTUAL",
"Threshold": 50,
"ThresholdType": "PERCENTAGE"
},
"Subscribers": [
{
"Address": "[email protected]",
"SubscriptionType": "EMAIL"
}
]
}
]
31 changes: 31 additions & 0 deletions aws/json/budget.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"BudgetLimit": {
"Amount": "10",
"Unit": "USD"
},
"BudgetName": "Example Tag Budget",
"BudgetType": "COST",
"CostFilters": {
"TagKeyValue": [
"user:Key$value1",
"user:Key$value2"
]
},
"CostTypes": {
"IncludeCredit": true,
"IncludeDiscount": true,
"IncludeOtherSubscription": true,
"IncludeRecurring": true,
"IncludeRefund": true,
"IncludeSubscription": true,
"IncludeSupport": true,
"IncludeTax": true,
"IncludeUpfront": true,
"UseBlended": false
},
"TimePeriod": {
"Start": 1477958399,
"End": 3706473600
},
"TimeUnit": "MONTHLY"
}
41 changes: 41 additions & 0 deletions aws/json/service-backend-flask.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"cluster": "cruddur",
"launchType": "FARGATE",
"desiredCount": 1,
"enableECSManagedTags": true,
"enableExecuteCommand": true,
"loadBalancers": [
{
"targetGroupArn": "arn:aws:elasticloadbalancing:us-east-1:730331264766:targetgroup/cruddur-backend-flask-tg/fb2fd7e553317afd",
"containerName": "backend-flask",
"containerPort": 4567
}
],
"networkConfiguration": {
"awsvpcConfiguration": {
"assignPublicIp": "ENABLED",
"securityGroups": [
"sg-0abca869cdbf1a4f4"
],
"subnets": [
"subnet-089d721f396a65cf4",
"subnet-05095853de204f9f1",
"subnet-0aaf7ff438aeb86f8"
]
}
},
"propagateTags": "SERVICE",
"serviceName": "backend-flask",
"taskDefinition": "backend-flask",
"serviceConnectConfiguration": {
"enabled": true,
"namespace": "cruddur",
"services": [
{
"portName": "backend-flask",
"discoveryName": "backend-flask",
"clientAliases": [{"port": 4567}]
}
]
}
}
Loading