How To Create and Configure VPC and Subnets In AWS

To create VPC, you first need to specify IP range. Each subnet takes IP range within the IP range of VPC. Before you decide the IP range, it is a good practice to plan first. You need to use CIDR notation for IP range. There is a cool tool to check the IP range of a given CIDR block and vise versa here.

This is one of the steps in How To Create Your Personal Data Science Computing Environment In AWS.

According to my plan, I have VPN that takes CIDR range of 10.0.0.0/16 (10.0.0.0 to 10.0.255.255, total of 65536 hosts).

There are two subnets. The first one takes 10.0.0.0/24 (10.0.0.0 to 10.0.0.255) in Availability Zone 1. The second one takes 10.0.1.0/24 (10.0.1.0 to 10.0.1.255) in Availability Zone 2. Make sure that the IP ranges do not overlap between them. AWS reserves five IP addresses (first four and last one) in each subnet. The first 4 IP addresses are reserved for networking purpose (like routing or local VPC DNS). The last address .255 is a broadcast address not used by AWS, so AWS reserves it. Therefore, you only get  251 IPs instead of full 256.

Once you have subnets, attach Internet Gateway to VPC and create route tables for each subnets.

Plan

Steps

(1) Go to VPC wizard from AWS Management Console.

(2) Create VPC with the correct IP range.

Specify IP range as the plan. I named my VPC as mydatahack.

(3) Create Subnet A in Availability Zone 1 and B in Availability Zone 2.

Set the CIDR range for each subnet according to the plan. 10.0.0.0/24 and 10.0.1.0/24. Choose the right VPC and Availabilty Zone. Below is the example of Subnet A.

(4) Create Internet Gateway and attach it to VPC

This part should be straight forward. Make sure to choose the right VPC.

(5) Create two route tables for both subnets in VPC

Let’s make Subnet A accessible from the Internet while Subnet B has restricted access from your computer. Default is that resources from the VPC can access to each other. Note that Subnet B has an IP address of the local computer you use. In this way, you can access to the database from your local machine. Make sure to choose the right Internet Gateway.

Subent A

Subnet B

(6) Associate Subnet to Route Table

After you create the route tables, edit the subnet associated to each route table.

 
Cool. Now you have VPC and Subnets. Let’s go back to How To Create Your Personal Data Science Computing Environment In AWS to complete the rest of the steps!

Git
How to specify which Node version to use in Github Actions

When you want to specify which Node version to use in your Github Actions, you can use actions/setup-node@v2. The alternative way is to use a node container. When you try to use a publicly available node container like runs-on: node:alpine-xx, the pipeline gets stuck in a queue. runs-on is not …

AWS
Using semantic-release with AWS CodePipeline and CodeBuild

Here is the usual pattern of getting the source from a git repository in AWS CodePipeline. In the pipeline, we use AWS CodeStart to connect to a repo and get the source. Then, we pass it to the other stages, like deploy or publish. For some unknown reasons, CodePipeline downloads …

DBA
mysqldump Error: Unknown table ‘COLUMN_STATISTICS’ in information_schema (1109)

mysqldump 8 enabled a new flag called columm-statistics by default. When you have MySQL client above 8 and try to run mysqldump on older MySQL versions, you will get the error below. mysqldump: Couldn’t execute ‘SELECT COLUMN_NAME, JSON_EXTRACT(HISTOGRAM ‘$”number-of-buckets-specified”‘) FROM information_schema.COLUMN_STATISTICS WHERE SCHEMA_NAME = ‘myschema’ AND TABLE_NAME = ‘craue_config_setting’;’: Unknown …