Back-end Engineering Articles

I write and talk about backend stuff like Ruby, Ruby On Rails, Databases, Testing, Architecture / Infrastructure / System Design, Cloud, DevOps, Backgroud Jobs, and more...



Rails + AWS + ElasticBeanstalk & React + AWS + Amplify

## first important things
1- Create app with Ruby 2.6.7 ==> Because AWS takes this version ==> rvm use 2.6.7
2- When creating the app in ElasticBeanstalk dashboard I need to set
  - RAILS_ENV: production (don't confuse with RACK_ENV)
  - SECRET_KEY_BASE: aer152sdf... (choose the secret_key_base given by EDITOR="atom --wait" bin/rails credentials:edit)
    if this doens't work, I've to use the command `rake secret`, is different, and copy this in environments
3- Don't forget to change ENVs in database.yaml

## this is the tutorial that Im following: <>

It works! seems like the ENV vars are a pain in the but

## simple tutorial to allocate IPv4 to have this as a subdomain under app

## to access to ElasticBeanstalk and rails console and other commands in production, I need to install eb cli
## connect EC2 environment with CLI

## comands
eb ssh # add credentials
$ cd /var/app/current
$ bundle exec rails c
$ bundle exec rails db:seed
## other rails commands as normal

## react + amplify

# don't forget in local machine:
npm install
npm run-script build

Initial tutorial: <>
Quite easy to follow, the only thing I had problem, was upgrade node-sass 
package to version 12, I saw the error in AWS logs. 

Then, aws create a personaliced subdomain, who I needed to change in order 
to point to my subdomain under
What I did here was:
1- Create under Route53 - aws service a hosted zone domain, under
2- Inside Amplify console, and under Domain management link, I followed this 
tutorial: <>

Things Im trying to confirm neccesary:
1- Don't touch Namecheap
2- Inside Route53
  * create subdomain:
3- Once Route53 is created, change Amazon NS created for my cloudflare NSs:
4- Create Custom Domain under Amplify: <>
5- Inside Cludflare validate and NS - Validation SSL under Cloudflare:
  * Type: CNAME
  * Name:
  * Target: (with extension)
  * Proxy Status: DNS Only
6- Once validation is ready, add other CNAMEs in Cloudflare. This CNAMEs are displayed
only when the SSL config inside Amplify is ready, and they give the instructions
  * Type: CNAME
  * Name: app
  * Target:
  * Proxy Status: DNS Only
  * Type: CNAME
  * Name:
  * Target:
  * Proxy Status: DNS Only
 7- Others
   * No needed to change build settings (default setup)
   * No needed to change Rewrites and redirects (default setup)


## Next tutorial
Next: <>