FreeCompute_24_00004 - itnett/FTD02H-N GitHub Wiki
🌱 Year 1: Foundations in Cloud Computing, DevOps, and CI/CD
🛠️ Core Components: CI/CD and Automation with GitHub Actions and Terraform
In the first year, the goal is to set up CI/CD pipelines and start automating tasks using GitHub Actions and Terraform to deploy applications across multiple cloud providers.
🖥️ Step 1: Set Up GitHub Pro, Copilot, and Actions
-
Set Up GitHub Pro:
- Sign up for GitHub Student Developer Pack to get free GitHub Pro.
- Benefit: Unlimited private repositories, advanced collaboration tools, and access to GitHub Actions.
-
Enable GitHub Copilot:
- Activate GitHub Copilot for AI-powered code suggestions.
- Benefit: Autocomplete and AI-driven code generation will help you write code faster and smarter.
-
Set Up GitHub Actions:
- Navigate to your GitHub repository and create a
.github/workflows/ci.yml
file to set up your first CI/CD pipeline. - Sample CI/CD Workflow:
name: CI Pipeline on: push: branches: - main jobs: build: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v2 - name: Set up Node.js uses: actions/setup-node@v2 with: node-version: '14' - name: Install dependencies run: npm install - name: Run tests run: npm test
- Benefit: Automate testing and deployments every time you push changes to your repository.
- Navigate to your GitHub repository and create a
☁️ Step 2: Create Cloud Accounts and Use Free-Tier Services
Leverage free cloud services from AWS, Azure, Google Cloud, Heroku, and DigitalOcean in Year 1.
-
Create Microsoft Azure Account:
- Sign up for Azure Free for Students.
- Use $100 in credits and access Azure App Services, Azure Functions, and Blob Storage.
- Tip: Deploy simple web apps or serverless functions to practice cloud development.
-
Create AWS Educate Account:
- Sign up for AWS Educate to receive $100 in credits.
- Set up AWS Lambda for serverless applications, S3 for storage, and DynamoDB for databases.
- Tip: Deploy small apps using Lambda and store files in S3 to learn cloud storage and function-based architectures.
-
Create Google Cloud Account:
- Sign up for Google Cloud Free Tier and receive $300 in free credits for 90 days.
- Use Compute Engine micro-instance (0.25 vCPU, 1 GB RAM) and experiment with Google Cloud Functions.
- Tip: Set up a micro-instance to run a simple web server or test containerized apps.
-
Create DigitalOcean Account:
- Get DigitalOcean $200 credits for one year and use them to create droplets (VMs).
- Tip: Deploy basic websites or apps on lightweight VMs to compare performance with other cloud providers.
-
Create Heroku Account:
- Sign up for Heroku and enjoy $13/month in credits for 24 months.
- Tip: Deploy web apps easily by connecting your GitHub repository to Heroku’s pipelines.
🛠️ Step 3: Automate Infrastructure with Terraform
-
Install Terraform:
- Install Terraform on your local machine to begin managing infrastructure as code (IaC).
- Benefit: Automate cloud resource provisioning and avoid manual configuration errors.
-
Create a Simple Terraform Script for AWS:
- Example AWS EC2 Instance:
provider "aws" { region = "us-west-2" } resource "aws_instance" "my_instance" { ami = "ami-0c55b159cbfafe1f0" # Amazon Linux 2 AMI instance_type = "t2.micro" tags = { Name = "TerraformEC2" } }
- Tip: Use the AWS free-tier to spin up EC2 instances, and test infrastructure automation.
- Example AWS EC2 Instance:
-
Create a Simple Terraform Script for Azure:
- Example Azure VM:
provider "azurerm" { features {} } resource "azurerm_resource_group" "my_rg" { name = "myResourceGroup" location = "West US" } resource "azurerm_linux_virtual_machine" "my_vm" { name = "myVM" resource_group_name = azurerm_resource_group.my_rg.name location = azurerm_resource_group.my_rg.location size = "Standard_B1s" admin_username = "azureuser" os_disk { caching = "ReadWrite" storage_account_type = "Standard_LRS" } source_image_reference { publisher = "Canonical" offer = "UbuntuServer" sku = "18.04-LTS" version = "latest" } admin_ssh_key { username = "azureuser" public_key = file("~/.ssh/id_rsa.pub") } }
- Tip: Use free credits in Azure to provision virtual machines and gain hands-on experience.
- Example Azure VM:
-
Create a Simple Terraform Script for Google Cloud:
- Example Google Cloud Compute Engine:
provider "google" { project = "my-gcp-project" region = "us-central1" } resource "google_compute_instance" "my_instance" { name = "my-instance" machine_type = "f1-micro" zone = "us-central1-a" boot_disk { initialize_params { image = "debian-cloud/debian-9" } } network_interface { network = "default" access_config {} } }
- Tip: Use Google Cloud's free-tier VM to experiment with deployments using Terraform.
- Example Google Cloud Compute Engine:
🚀 Step 4: Deploy a Simple Multi-Cloud Web Application
-
Deploy the Web App:
- Create a simple web application (Node.js, Python, or static site) and deploy it to Heroku and DigitalOcean for initial testing.
- Use GitHub Actions to automate deployment on commit:
name: Deploy to Heroku on: push: branches: - main jobs: deploy: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v2 - name: Deploy to Heroku run: git push heroku main
-
Use Terraform for Multi-Cloud Infrastructure:
- Deploy different components (e.g., database, compute) on AWS, Azure, and Google Cloud using Terraform.
- Tip: Use Terraform's multi-provider functionality to provision resources across multiple clouds from a single configuration file.
🏆 Summary of Year 1 Goals:
- Set up core cloud accounts and free-tier services on AWS, Azure, Google Cloud, DigitalOcean, and Heroku.
- Build a simple CI/CD pipeline using GitHub Actions to automate application deployments.
- Start using Terraform to automate infrastructure on AWS, Azure, and Google Cloud.
- Deploy a simple web app across multiple clouds and gain practical hands-on experience.