Cloud Bootcamp: Bash and Networking

Knowing bash scripting and networking are essential to learning more about cloud engineering. I started learning the fundamentals of how networking works in AWS and bash scripting. Mastering both skills will help me understand engineering more.      

Bash

I created a script that asks a user for a folder and spell-checks every file in that folder.

  1.   Create text documents with misspelled words

  2.   Download aspell. Sudo apt-get install aspell

  3.   Start your script like this- #! /bin/bash 

  4.   for f in *.txt; do aspell check $f ; done




   This is a Bash script that performs a spell check using the aspell tool on all files with a ".txt" extension in the current directory.

   The script starts with the shebang line "#! /bin/bash", which specifies that the script should be run using the Bash shell.The "for" loop iterates over all files in the current directory that end with ".txt", assigning each file to the variable "f" in turn. The body of the loop then calls the "aspell" command with the "check" option, passing in the filename stored in the "f" variable. This will perform a spell check on each file and print out any misspelled words to the console. So, overall, this script is a simple way to spell-check all text files in the current directory using the "aspell" command-line tool.

Here are some basic Linux and bash commands so you can create bash scripts too.

  1.   Help- help and man.

  2.    Navigate-pwd, cd, pushd, and  popd.

  3.   List content- ls.

  4.    Find files- whereis, which, and find.

  5.    Directories- mkdir, touch, mv, rm, cp, and rmdir.

  6. .   View file contents- cat, head, tail, more, less, and grep.

  7.    Environment variables- env, and export.

  8.    Modify permissions- chown, chgrp, and chmod.

  9.   What are variables in bash? Taking you back to math class a variable is the value you give to an expression.

    Hello_message=’Hello World!’

    echo $hello_message

    How to assign the output of a command to available in Bash Ex. Current_dir=$(pwd)

    You must use double quotes  “”

    Constant: read-only variable_wont_change=”blue”

  10.    Conditional statements- let you write code that performs different tasks based on specified checks.

  11.    Case statements- The case statement simplifies complex conditions with multiple different choices.

  12.    Functions- a method used in shell scripts to group reusable code blocks.

  13.   Loops- a bash programming language statement which allows code to be repeatedly executed.

    Use breaks

    Different types of loops while, until and for

  14.    How to write a bash script.

    Create a new file, hello.sh and open it with nano.

    On the first line specify the interpreter to be used in the code. In this case it is Bash.The first part of the line, #!, is called the “shebang” and it indicates the start of a script.

    Save the code by pressing CTRL + X, then press Y and Enter.

AWS Networking

          AWS networking basics

  1.    CIDR- Classless Inter-Domain Routing (CIDR) is an IP address allocation method that improves data routing efficiency on the internet.

  2.   Subnets- a range of IP addresses in your VPC.

  3. Internet gateway- a horizontally scaled, redundant, and highly available VPC component that allows communication between your VPC and the internet.

  4.    Route tables- contain a set of rules, called routes, that determine where network traffic from your subnet or gateway is directed.

  5.   Nat gateway- a highly available AWS-managed service that makes it easy to connect to the Internet from instances within a private subnet in an Amazon Virtual Private Cloud (Amazon VPC).

  6.    NACL- An optional layer of security that acts as a firewall for controlling traffic in and out of a subnet.

  7.   Security group- acts as a virtual firewall for your EC2 instances to control incoming and outgoing traffic.

  8.   API Gateway- helps it simple to create, publish, maintain, monitor, and secure APIs at scale.

  9.   CloudFront- delivers content faster including data, videos, applications, and APIs.

  10.    Route 53- Changes IP addresses to domain names and the other way around so computers can be connected with each other. For example, 192.0.7.1 into www.forexample.com.

  11.    VPC- gives you an isolated section of the AWS cloud.

  12.    App Mesh- monitors and controls microservices.

  13.    Cloud Map- With AWS Cloud Map, you can define custom names for your application resources, and it maintains the updated location of these dynamically changing resources.

  14.    Direct Connect- makes it easy to establish a dedicated network connection from your premises to AWS.

  15.    Global Accelerator- a networking service that improves the availability and performance of the applications that you offer to your global users.

  16.    Privatelink- simplifies the security of data shared with cloud-based applications by eliminating the exposure of data to the public Internet.

  17.    Private 5G- an easy way to use cellular technology to augment your current network.

  18.    Transit Gateway- a service that enables customers to connect their Amazon Virtual Private Clouds (VPCs) and their on-premises networks to a single gateway.

  19.    VPN- solutions establish secure connections between your on-premises networks, remote offices, client devices, and the AWS global network.

  20.    Elastic Load Balancing- automatically distributes incoming application traffic across multiple targets, such as Amazon EC2 instances, containers, and IP addresses.

  21.    Integrated Private Wireless on AWS- designed to provide enterprises with managed and validated private wireless offerings from leading Communications Service Providers.

        VPN architecture breakdown

  1.   VPC- the VPC can be used to host the VPN gateway and the private subnet.

  2.   Security Group- the security group can be used to control access to the VPN gateway.

  3.   Private subnet- private subnet can be used to host the resources that need to be accessed via the VPN.

  4.   Route table- a separate route table can be created for the private subnet that routes traffic through the VPN gateway.

  5.   VPN gateway- used to establish the VPN connection to the customer gateway.

  6.   VPN connection- VPN connection can be established over the internet.

  7.   Customer gateway- the customer gateway can be configured to establish the VPN connection to the VPN gateway hosted in the VPC.

  8. Why would you use this diagram? This architecture can provide a secure and reliable way for customers to access their resources hosted in AWS using a VPN connection.

Secure web application breakdown

  1.   VPC- the VPC can be used to host the public subnet.

  2.   Public subnet- the public subnet can be used to host the web application.

  3.   Security group- the security group can be used to control access to the web application.

  4.   Route table- a separate route table can be created for the public subnet that routes traffic through the internet gateway.

  5.   Internet gateway- the internet gateway can be used to enable internet access to the web application.

  6.   Why would you use this diagram? - This architecture can provide a scalable and secure way for customers to host their web applications on AWS in a public subnet, which can be accessed over the internet. The security group can be used to control access to the web application, and the route table and internet gateway can be used to enable internet access to the web application.

I hope you enjoyed this blog post. Please see the two links below to learn more about AWS networking and bash scripting.

https://devhints.io/bash

https://aws.amazon.com/products/networking/

Previous
Previous

Cloud Bootcamp: Python and Git

Next
Next

THINGS I LEARNED FROM THE AWS CERTIFIED Security Speciality CERTIFICATION