AWS Set up
pohanlu
Mon, Sep 5, 2022
Create account
- Click 👉 here 👈 to sign up AWS account
- Follow the steps to finish Identity authentication
- Log in your AWS account
Create a key pair
- AWS uses public-key cryptography to secure the login information for your instance.
- You specify the name of the key pair when you launch your instance, then provide the private key when you log in using SSH.
- Click 👉 here 👈 and choose Create key pair!
- Follow the graph to fill and choose
- For Name, enter a descriptive name for the key pair.
- Amazon EC2 associates the public key with the name that you specify as the key name.

- Private key file is automatically downloaded by your browser.
- This is the only chance for you to save the private key file.
- If you will use an SSH client on a macOS or Linux computer to connect to your Linux instance, use the following command to set the permissions of your private key file.
Create a security group
- Security groups act as a firewall for associated instances, controlling both inbound and outbound traffic at the instance level.
- You must add rules to a security group that enable you to connect to your instance from your IP address using SSH.
- If you plan to launch instances in multiple Regions, you'll need to create a security group in each Region.
- Click 👉 here 👈 to open Amazon EC2 console
- From the top navigation bar, select a Region for the security group.

- After choose region, next is to Create security group

- For Inbound rules, create rules that allow specific traffic to reach your instance.
- Use the following rules for a web server that accepts HTTP and HTTPS traffic.
- For Outbound rules, keep the default rule, which allows all outbound traffic.
- Then, choose Create security group
Create instance
AppWorks environment setup
- Instance type should be t2.micro.
- Machine image should be Amazon Linux 2 AMI.
- Attach 8GB General Purpose SSD storage at least.
- Click 👉 here 👈 to open Amazon EC2 console
- Choose Launch instance and choose what you need
- From Amazon Machine Image (AMI), select an HVM version of Amazon Linux 2
- From Instance type, choose the t2.micro instance type

- Under Key pair (login), choose the key pair that you created when getting set up.
- Next to Network settings, choose Select existing security group.
- Final is Configure storage, choose
1x 8 GiB gp2 Root volume
- Review your instance configuration in the Summary panel (right hand side)
- Then, choose Launch instance
Connect to instance
- Click 👉 here 👈 to check the instance
- Choose the instance and click Connect

- Choose SSH Client and follow the steps

Install Node.js on instance
- Connect to your Linux instance as
ec2-user
using SSH
- Install node version manager (nvm)
- Activate nvm
- Use nvm to install the latest version of Node.js
- Check Node.js is installed or not
Install MySQL Server
- Connect to your Linux instance as
ec2-user
using SSH
- Need to update privileges to root user before installing the MySql
若出現下列錯誤:you need to be root to perform this command
- Sol. 輸入
su
,按下 enter,並輸入密碼
- 忘記密碼時,輸入
sudo passwd
,重置密碼,再輸入su
- Updates all packages to the latest version
- Install MySQL
To Enable mysql to start when system reboots
Enter sudo systemctl enable mariadb
- We need to secure the installation
Then, it will ask you a few questions,
- Q: Enter current password for root ( enter for none ) :
- Q: Set Root password? [Y/n]
- A: Type ‘y’ and then press enter
- Q: Remove anonymous user? [Y/n]
- A: type ‘y’ and press enter
- Q: Disallow root login remotely? [Y/n]
- A: type ‘y’ and press enter
- Q: Remove test database and access to it? [Y/n]
- A: Type ‘y’ and press enter
- Q: Reload privilege tables now? [Y/n]
- A: Type ‘y’ and press enter
- Connect to MySQL, and you will see
Welcome to the MariaDB monitor