0.0.8 • Published 1 year ago

@0bdx/srv-api v0.0.8

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

@0bdx/srv-api

A simple JSON API in Node.js which works with Mongo-like databases.

  Version: 0.0.8
  NPM: https://www.npmjs.com/package/@0bdx/srv-api
  Repo: https://github.com/0bdx/srv-api
  AWS Billing Dashboard: https://eu-central-1.console.aws.amazon.com/billing
  App Runner Console: https://eu-central-1.console.aws.amazon.com/apprunner

Running locally

To use port 1234 (instead of 8080, the default):
$ PORT=1234 npm start

AWS billing

All prices here are before tax.

GitHub connections billing

As far as I can tell, ‘GitHub connections’ do not appear on the AWS invoice, and are not charged for.

Bandwidth billing

Bandwidth falls under the year-long free tier, and memory-usage does not seem to be charged-for:

  • Bandwidth $0.000 per GB - data transfer out under the monthly global free tier 0.002 GB = USD 0.00

App Runner billing

App Runner is fairly cheap. You are charged by the hour, with separate charges for the ‘build’ service, and the ‘run’ service. The ‘run’ service is divided into ‘provisioned’ (which I think is “up time”), and a charge for CPU time.

On the free tier, while developing this repo, I recreated the app maybe twelve times, so the ‘build’ charge is much higher than a real app would be:

  • USD0.005 per Mins for AppRunner-Build-mins in EU (Frankfurt) 21 Mins = USD 0.11
  • AWS App Runner - Provisioned - GB-hours - EU (Frankfurt) 8.122 hours = USD 0.07
  • USD0.074496 per vCPU-hour for AppRunner-vCPU-hours:RunService in EU (Frankfurt) 0.004 vCPU-hour = USD 0.00

Note that ‘Automatic deployments’ could cost $1 per application per month.
I did try using these, but didn’t see a charge appear on my bill yet.

Bandwidth billing

Bandwidth falls under the year-long free tier, and memory-usage does not seem to be charged-for:

  • Bandwidth $0.000 per GB - data transfer out under the monthly global free tier 0.002 GB = USD 0.00

CloudWatch billing

There’s a free log-monitoring service called CloudWatch which could probably be switched off (the App Runner console provides logs you can manually refresh):

  • Amazon CloudWatch 0.00 per alarm metric month - first 10 alarm metrics 0.001 Alarms = USD 0.00
  • AmazonCloudWatch EUC1-TimedStorage-ByteHrs First 5GB-mo per month of logs storage is free. 0 GB-Mo = USD 0.00
  • AmazonCloudWatch PutLogEvents First 5GB per month of log data ingested is free. 0 GB = USD 0.

Set up AWS

Set up the GitHub connection

Click ‘GitHub connections’ in the sidebar at https://eu-central-1.console.aws.amazon.com/apprunner.
If this is the first time you’ve used App Runner, it will probably be empty.

Click ‘Create an App Runner service’ at https://eu-central-1.console.aws.amazon.com/apprunner.
Click ‘Source code repository’.
Under ‘Connect to GitHub’, click ‘Add new’.
Wait for a new window to open (disable your popup-blocker browser extension).

  • Connection name: srv-api--cnx
  • GitHub app: Allow AWS to connect to your GitHub account

After clicking ‘Next’, and clicking ‘GitHub connections’ in the sidebar again, you should see srv-api--cnx listed.

Set up the App Runner instance

This app is set to deploy from main, manually (so, pushes to main do not automatically deploy a new version of the service).

Click ‘Create an App Runner service’ at https://eu-central-1.console.aws.amazon.com/apprunner.

  • Repository type: Source code repository
  • Connect to GitHub: srv-api--cnxsrv-apimain
  • Deployment trigger: Manual (or Automatic, which costs $1 per application per month)
  • Configuration file: Configure all settings here
  • Runtime: Nodejs 16
  • Build command: npm install (should only install deps, not †he dev-deps)
  • Start command: npm start (or npm start -- -dvw while debugging)
  • Port: 8080
  • Service name: srv-api-App-Runner-Instance
  • Virtual CPU & memory: 1 vCPU2 GB
  • Health check: Path: / (which MUST respond with a 200 HTTP status)
  • Health check: Interval: 20 (once every 20 seconds is the maximum AWS allows)

…and keep the defaults for all the other settings.
Click ‘Next’ and then ‘Create and deploy’.
w

0.0.8

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago