Repository for sample auth api.
- Export environment variables
$ touch .envrc $ echo "dotenv" >> .envrc $ touch .env $ echo "CDK_DEFAULT_ACCOUNT=<YOUR AWS ACCOUNT FOR DEPLOY APPS>" >> .env $ echo "CDK_DEFAULT_REGION=<YOUR AWS REGION FOR DEPLOY APPS>" >> .env $ echo "AWS_VAULT_BACKEND=pass" >> .env $ echo "AWS_VAULT_PASS_PREFIX=aws-vault" >> .env $ echo "AWS_SESSION_TOKEN_TTL=1h" >> .env $ echo "AWS_DEFAULT_REGION=<YOUR AWS DEFAULT REGION>" >> .env $ direnv allow
```
$ make dev-deps deploy-deps
```
- Generate GPG key
$ gpg --gen-key
- Initialize password-store
$ pass init <TYPED EMAIL IN GPG GENERATION>
- Register your aws profile
$ aws-vault add <PROFILE NAME> Enter Access Key ID: <YOUR AWS ACCESS KEY> Enter Secret Access Key: <YOUR AWS SECRET ACCESS KEY>
- Check for successful completion
$ aws --profile <PROFILE NAME> s3 ls
- Visual Studio Code
- Get AWS credential (expires in 1h)
$ AWS_PROFILE=<PROFILE NAME> make cache-credentials
- Select the Debug tab from the Activity Bar on the left side
- Select
auth-api-server
from the pull-down menu at the top of the Side Menu - Click the green triangle icon button to start debugging
- Get AWS credential (expires in 1h)
- Build applications
$ make build
- Archive bin files for Lambda
$ make archive
- Deploy applications
$ AWS_PROFILE=<PROFILE NAME> DEPLOY_ENV=<DEPLOY ENV NAME> make deploy
$ AWS_PROFILE=<PROFILE NAME> DEPLOY_ENV=<DEPLOY ENV NAME> make destroy
- Fetch ssh key for bastion
$ AWS_PROFILE=<PROFILE NAME> make fetch-bastion-key
- Open ssh tunnel
$ AWS_PROFILE=<PROFILE NAME> make open-bastion-tunnel
- Connect to DB
$ mysql -u <DB USER> -D <DB NAME> -h 127.0.0.1 -P 3307 -p