Skip to content

Instantly share code, notes, and snippets.

@gohjiaying
gohjiaying / Debug_Experience.md
Last active April 12, 2020 13:44
A list of debugging techniques

Severless, lambda, Api Gateway

When testing on api gateway received a "module initialization error" but do not know what's the error.

  1. Check api-gateway error logs
  2. Test that the lambda works from console (This helped me to solve my problem)

About CORS:

CORS stands for Cross-origin resource sharing. It is a set of standard HTTP headers used to restrict the access of web resources from other domains. In the web app security model, this is called same-origin policy, and it's supposed to avoid cross-site scripting (XSS) attacks. Browsers will not fetch the requested resources unless the corresponding server attaches the required HTTP headers in the OPTIONS call (or GET method).

Useful Commands

Docker

Code Description
docker rm $(docker ps -a -q -f status=exited) To remove all the containers that have exited
EC2_REGION=wget -q -O - http://169.254.169.254/latest/meta-data/placement/availability-zone|sed s/.$//
aws ecr get-login --region $EC2_REGION --no-include-email
To login into ECR
docker pull amazon/amazon-ecs-sample Just a ecs sample

Docker CLI Download

  1. Download Docker Cloud
  2. Open application and sign in
  3. Go CLI docker ps

Visual Studio Code

  • For AWS Client , it is region specific. If different region is required, have 2 client.
  • Download AWS Toolkit

AWS CLI and login via SSO

@gohjiaying
gohjiaying / bash-cheatsheet.sh
Last active April 12, 2020 13:41 — forked from LeCoupa/bash-cheatsheet.sh
Bash CheatSheet for UNIX Systems --> UPDATED VERSION --> https://github.com/LeCoupa/awesome-cheatsheets
#!/bin/bash
#####################################################
# Name: Bash CheatSheet for Mac OSX
#
# A little overlook of the Bash basics
#
# Usage:
#
# Original Author: J. Le Coupanec
# Date: 2014/11/04