Offical website, https://www.pulumi.com/
brew install pulumi
Sign up a new account in pulumi website since you need a Access Token
Then go to https://app.pulumi.com/socloud/settings/tokens, create new token
Back to terminal, login your pulumi account
You can see which account your logged in by using
Start new project, …
Below is a simple example for createing an s3 bucket
Add dotenv package
yarn add dotenv
and place BUCKET_NAME key which is the name of the bucket name you want
Add an index.ts in root
In terminal, generate ssh key
ssh-keygen -t rsa -C "your_username@your_email.com@bitbucket"
Will ask you file name to for generate this ssh key, and this example we are going to generate ssh for different git, e.g. bitbucket and github which using different ssh key
$ ssh-keygen -t rsa -C "your_username@your_email.com@github1"
$ ssh-keygen -t rsa -C "your_username@your_email.com@github2"
Next, setup your ssh config file, which located in your ~/.ssh folder
$ mkdir .ssh
$ cd .ssh
$ touch config
Here is an example of the config file
# GitHub michaelmaky
IdentityFile ~/.ssh/id_rsa_github_michaelmaky# GitHub michaelmaky
HostName github.com …
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install java
# if you want to install multi-version
brew install --cask adoptopenjdk8
brew install --cask adoptopenjdk11
brew install --cask adoptopenjdk16
these will be installed into /Library/Java/JavaVirtualMachines/ which is the traditional location on Mac OSX.
For M1 Mac, Since zsh is the default Terminal shell, so place script below either in your ~/zprofile / or ~/.zshenv or ~/.zshrc
export JAVA_8_HOME=$(/usr/libexec/java_home -v1.8)
export JAVA_11_HOME=$(/usr/libexec/java_home -v11)alias java8='export JAVA_HOME=$JAVA_8_HOME'
alias java11='export JAVA_HOME=$JAVA_11_HOME'# default to Java 11
then you can use command java8 or java11 to switch your java runtime…
To enable graphQL in your nestjs api, you can first read the offical document here.
Step 1, install npm package need
yarn add @nestjs/graphql graphql-tools graphql graphql-type-json apollo-server-express
declare a simple factory class for graphQL
In app.module.ts, add GraphQL module
and also define .gql under schema
Next, create order.resolver.ts which make graphQL support same request as restful, which define in order.controller.
Use postman to make a request for getOrders, we copy the sample request query and variable below
Here is the result which same as using restful API
The sample code is here, hope this help.
Go to Stripe to create an account
Navigate to left menu > Developers > API keys, there is a publishable key and secret key, publishable key is used in front end below checkout
Imagine there is an checkout form in web / app, you input credit card, CVC, expired month and year in the form and checkout, In stripe, you need to use those information to get the source id of this payment
Below we use postman with the publishable key to get source id
nest new nestjs-api
Install mongoose package and create mongo db connection helper, this helper can works fine with local mongodb and mongodb altas
Import mongoose module into App module
Generate our first module using generator, ref: https://docs.nestjs.com/recipes/crud-generator
nest g resource orders
As I need to works with mongodb, I need to rename folders
In this tutorial, I’ll build a simple NodeJS API which will be deployed in AWS Lambda and the endpoints will be exposed using AWS API gateway. The deployment will use Bitbucket pipelines which allow you to preform CICD when code change in a specific branch, also the configuration will be defined in AWS SAM template.
Cloudformation (SAM) allows you to manage your AWS infrastructure using just a yaml file. Using these two tools you can create a solid CD environment from scratch.
Suppose you have an AWS account and now create an IAM user with following policies
Step 1: Setup for s3 website
Refer to here you can setup: https://docs.aws.amazon.com/AmazonS3/latest/userguide/WebsiteHosting.html
Step 2: Setup DNS, e.g. cloudfare
After setup CNAME of your website host in AWS S3, you can see your website content “Welcome to my website” base on document below
Step 3: Setup IAM user which can access this bucket
Refer to my other tutorial
Step 4: Setup Deployment variables of your repo
Refer to my other tutorial,
Define Deployment variables
Step 5: update package.json script, we use max_old_space_size=2048 since the ci server is not a very powerful machine
First Part is about AWS SES setup guileline
Go to AWS Console, enter SES Home
Go to Domains > Verify a New Domain button, enter your domain, it shows picture below and you can use these information by input to your DNS management of this domain, e.g. cloudflare
Normally, within 24 hours or less, AWS SES will finish verify your domain and go back to SES console page, status update to verified