<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Harrison Ifeanyi</title>
    <description>The latest articles on DEV Community by Harrison Ifeanyi (@fo_cused).</description>
    <link>https://dev.to/fo_cused</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1259685%2F9726a2c9-444a-45a7-ac23-4e75aec163fe.png</url>
      <title>DEV Community: Harrison Ifeanyi</title>
      <link>https://dev.to/fo_cused</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/fo_cused"/>
    <language>en</language>
    <item>
      <title>Build Infrastructure with Terraform on Google Cloud</title>
      <dc:creator>Harrison Ifeanyi</dc:creator>
      <pubDate>Fri, 19 Apr 2024 16:39:01 +0000</pubDate>
      <link>https://dev.to/fo_cused/build-infrastructure-with-terraform-on-google-cloud-3n6a</link>
      <guid>https://dev.to/fo_cused/build-infrastructure-with-terraform-on-google-cloud-3n6a</guid>
      <description>&lt;p&gt;TASK TO BE DONE:&lt;br&gt;
Task 1. Create the configuration files&lt;br&gt;
Task 2. Import infrastructure&lt;br&gt;
Task 3. Configure a remote backend&lt;br&gt;
Task 4. Modify and update infrastructure&lt;br&gt;
Task 5. Destroy resources&lt;br&gt;
Task 6. Use a module from the Registry&lt;br&gt;
Task 7. Configure a firewall&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Task 1. Create the configuration files&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;main.tf&lt;br&gt;
variables.tf&lt;br&gt;
modules/&lt;br&gt;
└── instances&lt;br&gt;
    ├── instances.tf&lt;br&gt;
    ├── outputs.tf&lt;br&gt;
    └── variables.tf&lt;br&gt;
└── storage&lt;br&gt;
    ├── storage.tf&lt;br&gt;
    ├── outputs.tf&lt;br&gt;
    └── variables.tf&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Step 1:&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Run:&lt;br&gt;&lt;br&gt;
mkdir -p modules/storage modules/instances&lt;/p&gt;

&lt;p&gt;Run: &lt;br&gt;
touch modules/instances/variables.tf modules/instances/outputs.tf modules/instances/instances.tf modules/storage/variables.tf modules/storage/outputs.tf modules/storage/storage.tf&lt;/p&gt;

&lt;p&gt;Run: &lt;br&gt;
touch main.tf outputs.tf variables.tf&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F28v9474gqutjt9hfzhfd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F28v9474gqutjt9hfzhfd.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then in your &lt;strong&gt;main.tf&lt;/strong&gt;:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

terraform {
  required_providers {
    google = {
      source = "hashicorp/google"

    }
  }
}

provider "google" {

  project = var.project_id
  region  = var.region
  zone    = var.zone
}



&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxej6wxstl4mn4muiidg7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxej6wxstl4mn4muiidg7.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In all your &lt;strong&gt;variables.tf&lt;/strong&gt; files:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

Variable “zone” {
    Default = ”ZONE”
}

Variable “project_id” {
    Default = ”PROJECT_ID”
}

Variable “region” {
    Default = ”REGION”
}




&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;NOTE:&lt;/strong&gt;&lt;br&gt;
To be added in the VARIABLES.TF in the root, instances.tf and storage.tf&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkhf1iq22nwbes0onpk5m.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkhf1iq22nwbes0onpk5m.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then run: &lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

terraform init


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Folvp9ivhxy7pmd75nwyw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Folvp9ivhxy7pmd75nwyw.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Task 2. Import Terraform configuration&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Step 1:&lt;/em&gt;&lt;br&gt;
STEPS IN CREATING VMs&lt;/p&gt;

&lt;p&gt;Navigate to Google Cloud Console&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Select or Create a Project: if you haven't already, create a new project or select an existing project where you want to create your compute instances&lt;/li&gt;
&lt;li&gt;Navigate to Compute Engine: in the Google Cloud Console, navigate to the Compute Engine section. You can find it in the left sidebar under the "Compute" section.&lt;/li&gt;
&lt;li&gt;Create a New Instance: click on the "Create" button to create a new virtual machine instance.&lt;/li&gt;
&lt;li&gt;Configure Instance Details: fill out the necessary details for your instance, including:&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;Instance name: Give your instance a descriptive name.&lt;/li&gt;
&lt;li&gt;Region and Zone: Choose the region and availability zone where you want to deploy your instance.&lt;/li&gt;
&lt;li&gt;Machine type: Select the machine type that suits your requirements, such as CPU and memory specifications.&lt;/li&gt;
&lt;li&gt;Boot disk: Choose the operating system and disk size for the boot disk.&lt;/li&gt;
&lt;li&gt;Networking: Configure network settings such as VPC network, subnetwork, external IP address, and firewall rules.&lt;/li&gt;
&lt;li&gt;Advanced Configuration (Optional): you can also configure additional options such as GPU, metadata, and startup scripts if needed.&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;Review and Create: review the configuration of your instance to ensure everything is correct. &lt;/li&gt;
&lt;li&gt;Once you're satisfied, click the "Create" button to provision the instance.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Repeat to create another instance. We’re creating the instances so we can import them later into our terraform configuration and terraform can be responsible for managing them.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Step 2:&lt;/em&gt;&lt;br&gt;
In your instance.tf: &lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

resource "google_compute_instance" "INSTANCE_NAME-1" {
  name         = "tf-instance-1"
  machine_type = "e2-micro"
  zone         = var.zone

  boot_disk {
    initialize_params {
      image = "debian-cloud/debian-11"
      Size = “10”
    }
  }

  network_interface {
    network = "default"

  }
}


resource "google_compute_instance" "INSTANCE_NAME-2" {
  name         = "tf-instance-2"
  machine_type = "e2-micro"
  zone         = var.zone

  boot_disk {
    initialize_params {
      image = "debian-cloud/debian-11"
      Size = “10”
    }
  }

  network_interface {
    network = "default"

  }
}



&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ft5hjqbq8j30d6434upld.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ft5hjqbq8j30d6434upld.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then add the following to your main.tf:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

module “instances”{
    source = “./modules/instances”
}


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fal75hppqvvpc410vu36a.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fal75hppqvvpc410vu36a.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then run: &lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

terraform init


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkachd8z3tps3nlsqtavv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkachd8z3tps3nlsqtavv.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next:&lt;br&gt;
Run this command: &lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

terraform import module.instances.google_compute_instance.INSTANCE_NAME-1 INSTANCE_ID


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Then:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

terraform import module.instances.google_compute_instance.INSTANCE_NAME-2 INSTANCE_ID


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcgss67j7o890y808ar2n.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcgss67j7o890y808ar2n.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;NOTE:&lt;/strong&gt; INSTANCE_ID can be gotten from the console.&lt;/p&gt;

&lt;p&gt;Task 3. Configure a remote backend&lt;/p&gt;

&lt;p&gt;In your storage.tf file add the following&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

resource "google_storage_bucket" "STORAGE_BUCKET" {
  name        = "# REPLACE WITH YOUR PROJECT ID"
  location    = "US"
  uniform_bucket_level_access = true
  Force_destroy = true }



&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F71veck5hksy88swl4xnm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F71veck5hksy88swl4xnm.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then add the following to your main.tf file:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

module “compute_storage”{
        source = “./modules/storage”
}



&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fs3x3feo0vb8vyds586t8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fs3x3feo0vb8vyds586t8.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then run: &lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

terraform init


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9luz9z2gnpgsut01s38x.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9luz9z2gnpgsut01s38x.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then run:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

terraform apply


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqsi8nsf1xcbeap4eow74.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqsi8nsf1xcbeap4eow74.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After the bucket is created add the following to your main.tf in the terraform block&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

 backend "gcs" {
    bucket  = "# REPLACE WITH YOUR BUCKET NAME"
    prefix  = "terraform/state"
  }


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6u72o5xly86r5ico62i3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6u72o5xly86r5ico62i3.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Run:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

terraform init 


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;It should prompt you, type yes &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffgdgfkvkag85a8hp4t39.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffgdgfkvkag85a8hp4t39.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Task 4&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;To update infrastructure:&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;You only need to change machine-type argument from “e2-micro” to the type provided. This should be done in your &lt;strong&gt;instances.tf&lt;/strong&gt;  file&lt;/p&gt;

&lt;p&gt;The add a new instance resource in the same file&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

resource "google_compute_instance" "THIRD INSTANCE NAME" {
  name         = "THIRD INSTANCE NAME"
  machine_type = "SPECIFIED MACHINE TYPE"
  zone         = var.zone

  boot_disk {
    initialize_params {
      image = "debian-cloud/debian-11"
      Size = “10”
    }
  }

  network_interface {
    network = "default"

  }
}



&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3bya5q9hzm4vj9iebpkq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3bya5q9hzm4vj9iebpkq.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F312r62ddstfzt1xmewmc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F312r62ddstfzt1xmewmc.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdcjenf1cxyv8gsdlbwjk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdcjenf1cxyv8gsdlbwjk.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then run: &lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

terraform init


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi42w604va31gfu3974eg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi42w604va31gfu3974eg.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then: &lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

terraform apply 


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqns1mk5vlkoygekvyeq0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqns1mk5vlkoygekvyeq0.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Task 5&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To delete resource: You just remove the third instance configuration from your &lt;strong&gt;instances.tf&lt;/strong&gt;  file and then run &lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

terraform apply


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbq6445rkxid4wugq4zhr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbq6445rkxid4wugq4zhr.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Task 6&lt;/strong&gt;&lt;br&gt;
Add to your &lt;strong&gt;main.tf file&lt;/strong&gt;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

module "vpc" {
source  = "terraform-google-modules/network/google"
version = "9.0.0"
project_id   = "&amp;lt;PROJECT ID&amp;gt;"
network_name = "VPC_NAME"
routing_mode = "GLOBAL"
    subnets = [
        {
            subnet_name           = "subnet-01"
            subnet_ip             = "IP_RANGE"
            subnet_region         = var.region
        },
    {
            subnet_name           = "subnet-02"
            subnet_ip             = "IP_RANGE"
            subnet_region         = var.region
        },

]


}


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1hvqxgi5d9zabz1ezmfs.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1hvqxgi5d9zabz1ezmfs.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzognvurew052vyfc3703.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzognvurew052vyfc3703.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftocr08efa5ho4cj9vx8w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftocr08efa5ho4cj9vx8w.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After adding the block, run:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

terraform init 


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Faj7rp6k07vy0sxl26xjk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Faj7rp6k07vy0sxl26xjk.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then run:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

terraform apply


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F50pwhrbimnzl98w8elyq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F50pwhrbimnzl98w8elyq.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Task 7&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Add to your &lt;strong&gt;main.tf file&lt;/strong&gt;:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

resource “google_compute_firewal”l “FIREWALL_NAME”{
    name = “FIREWALL_NAME”
    network = module.vpc.network_name

    allow {
    protocol = "tcp"
    ports    = ["80"]
  }
    source_ranges = [0.0.0.0/0]
}




&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4n9s2pzoj2g2xo4xwj70.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4n9s2pzoj2g2xo4xwj70.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;run : &lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

terraform init 


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4yiycy7rz90gvqfyebwb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4yiycy7rz90gvqfyebwb.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;then : &lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

terraform apply


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F95yefzf7zwbsj9lv7txu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F95yefzf7zwbsj9lv7txu.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Update the &lt;strong&gt;instance.tf&lt;/strong&gt; file to use the newly created VPC and place each instance in a different subnet&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

resource "google_compute_instance" "INSTANCE_NAME-1" {
  name         = "tf-instance-1"
  machine_type = "e2-micro"
  zone         = var.zone

  boot_disk {
    initialize_params {
      image = "debian-cloud/debian-11"
      size = “10”
    }
  }

  network_interface {
    network = "VPC_NAME"
    subnetwork = “SUBNET_1”

  }
}


resource "google_compute_instance" "INSTANCE_NAME-2" {
  name         = "tf-instance-2"
  machine_type = "e2-micro"
  zone         = var.zone

  boot_disk {
    initialize_params {
      image = "debian-cloud/debian-11"
      size = “10”
    }
  }

  network_interface {
    network = "VPC_NAME"
    subnetwork = “SUBNET_2” 

  }
}




&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
    </item>
    <item>
      <title>Using Amazon S3 with Amazon CloudFront</title>
      <dc:creator>Harrison Ifeanyi</dc:creator>
      <pubDate>Fri, 19 Apr 2024 15:54:48 +0000</pubDate>
      <link>https://dev.to/fo_cused/using-amazon-s3-with-amazon-cloudfront-1728</link>
      <guid>https://dev.to/fo_cused/using-amazon-s3-with-amazon-cloudfront-1728</guid>
      <description>&lt;p&gt;&lt;strong&gt;Step 1&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;Create S3 bucket and enable it for static website hosting&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Go to AWS Management Console &amp;gt; Search for S3&lt;/p&gt;

&lt;p&gt;At this junction, we need to create a bucket for the project. &lt;/p&gt;

&lt;p&gt;Each S3 bucket in AWS needs to have a unique name as bucket names in AWS have to be unique globally&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx9haxut3u2bpza2r8ssq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx9haxut3u2bpza2r8ssq.png" alt="Image description" width="800" height="359"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The region where I ran my account was automatically made the region for the bucket&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;For Bucket Type: General Purpose&lt;/li&gt;
&lt;li&gt;For Bucket Name: I used &lt;strong&gt;harrisonawscloudclubproject&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc92ckdwfulwfenebvvmn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc92ckdwfulwfenebvvmn.png" alt="Image description" width="800" height="358"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Disable the ACL and also untick the Block All Public Access. Without the Block All Public Access unticked, there wouldn’t be any access to the bucket.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgg7pi4lg0gesi7fns4k8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgg7pi4lg0gesi7fns4k8.png" alt="Image description" width="800" height="362"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Unticking the Block All Public Access box triggered this warning but ignore&lt;/li&gt;
&lt;li&gt;Scroll down and click on Create Bucket&lt;/li&gt;
&lt;li&gt;Wait for the bucket to be created&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7kev9xqekd9ql9acxjhq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7kev9xqekd9ql9acxjhq.png" alt="Image description" width="800" height="360"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Bucket Created Successfully !!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 2&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;Enable Static Website Hosting&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Now that the bucket has been created and has been made public, it's time to enable static website hosting&lt;/p&gt;

&lt;p&gt;To achieve that; &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Click on the name of the bucket that you created&lt;/li&gt;
&lt;li&gt;You see the options on the tabs, select the PROPERTIES tab option&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fguytqkevjrwiaoi100bx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fguytqkevjrwiaoi100bx.png" alt="Image description" width="800" height="359"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Scroll to the end of the PROPERTIES page&lt;/li&gt;
&lt;li&gt;Static website hosting is the last option on the page&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fml4h466bqsvdnpgoqc8l.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fml4h466bqsvdnpgoqc8l.png" alt="Image description" width="800" height="343"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click on the Edit Button&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbwg80ihj1de4o1l8f3yl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbwg80ihj1de4o1l8f3yl.png" alt="Image description" width="800" height="354"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click on the Enable Button&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz63ob89kv3ngifruvs5y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz63ob89kv3ngifruvs5y.png" alt="Image description" width="800" height="361"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Under the Hosting Type, the &lt;em&gt;Host a Static Website&lt;/em&gt; is already enabled.&lt;/li&gt;
&lt;li&gt;Fill the index document with &lt;em&gt;index.html&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;Click on Save Changes &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnio8kjcz0gzrllx6799h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnio8kjcz0gzrllx6799h.png" alt="Image description" width="800" height="358"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Static Website Hosting enabled successfully!&lt;/p&gt;

&lt;p&gt;Go back to PROPERTIES, scroll down again to STATIC WEBSITE HOSTING, then click on the link you see in that section&lt;/p&gt;

&lt;p&gt;Once clicked, it opens a new tab that shows an error page:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy2eolxdb44jejry4zr2w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy2eolxdb44jejry4zr2w.png" alt="Image description" width="800" height="401"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is so because we haven’t configured the bucket policy to allow public access. Even though we unticked the Block All Public Access option, we still need to configure the BUCKET POLICY.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;Enable Public Access to the Bucket&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Head to the PERMISSIONS Tab&lt;/li&gt;
&lt;li&gt;Scroll down to BUCKET POLICY&lt;/li&gt;
&lt;li&gt;Click the EDIT button on BUCKET POLICY&lt;/li&gt;
&lt;li&gt;Click on POLICY GENERATOR&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvwwed8r4cu180iydv7tg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvwwed8r4cu180iydv7tg.png" alt="Image description" width="800" height="352"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Click on SELECT TYPE OF POLICY dropdown &lt;/li&gt;
&lt;li&gt;Choose S3 BUCKET POLICY&lt;/li&gt;
&lt;li&gt;In the PRINCIPAL box, input “*” (this gives permission to every type of access)&lt;/li&gt;
&lt;li&gt;On the ACTIONS dropdown, choose GET OBJECTS&lt;/li&gt;
&lt;li&gt;Go back to the EDIT BUCKET POLICY page, copy BUCKET ARN&lt;/li&gt;
&lt;li&gt;Go back to the POLICY GENERATOR page and paste it in the AMAZON RESOURCE NAME box&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpaqzgbkh60zvfyp0bb8r.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpaqzgbkh60zvfyp0bb8r.png" alt="Image description" width="800" height="354"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Click on ADD STATEMENT button&lt;/li&gt;
&lt;li&gt;Click on GENERATE POLICY&lt;/li&gt;
&lt;li&gt;A POLICY JSON DOCUMENT Modal pops up, copy the policy off the modal and click CLOSE&lt;/li&gt;
&lt;li&gt;Go back to EDIT BUCKET POLICY and paste it there and click on SAVE CHANGES&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;NOTE&lt;/strong&gt;: If you are receiving an error message, make sure you put “/*” at the end of the AMAZON RESOURCE NAME.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;STEP 4&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;Upload Objects into the Bucket&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Upload 2 files: index.html and the image that is going to be reflected in the index.html&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Click on OBJECTS&lt;/li&gt;
&lt;li&gt;Click on UPLOAD
&lt;/li&gt;
&lt;li&gt;Click on ADD FILES&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7beagbj675ps8m0eql3p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7beagbj675ps8m0eql3p.png" alt="Image description" width="800" height="352"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Files are uploaded and you click on UPLOAD&lt;/li&gt;
&lt;li&gt;Wait to get the UPLOADED SUCCEEDED message&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;STEP 5&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;Confirm that the static website hosting is working&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Click on PROPERTIES&lt;/li&gt;
&lt;li&gt;Scroll down to STATIC WEBSITE HOSTING&lt;/li&gt;
&lt;li&gt;Click on the URL in that section and it opens a new tab showcasing the files we uploaded to the S3 Bucket&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ft0dqs6jlwwg3kis73gvt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ft0dqs6jlwwg3kis73gvt.png" alt="Image description" width="800" height="359"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Now, it is important to mark and serve content through CLOUDFRONT DISTRIBUTION to be able to make use of the CACHING FUNCTION of CLOUD FRONT to reduce latency and continuous calls to the S3 Bucket.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;STEP 6:&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;Configure your Cloudfront&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Go to CLOUDFRONT&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbjeamf5hiqev5qxa5tse.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbjeamf5hiqev5qxa5tse.png" alt="Image description" width="800" height="356"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Click on CREATE DISTRIBUTION&lt;/li&gt;
&lt;li&gt;ORIGIN DOMAIN: The S3 Bucket you created&lt;/li&gt;
&lt;li&gt;Scroll down to ORIGIN ACCESSS&lt;/li&gt;
&lt;li&gt;Select ORIGIN ACCESS CONTROL SETTING &lt;/li&gt;
&lt;li&gt;Select the bucket you created &lt;/li&gt;
&lt;li&gt;Back to the CREATE DISTRIBUTION page,&lt;/li&gt;
&lt;li&gt;Under the WEB APPLICATION FIREWALL (WAF), Select DO NOT ENABLE SECURITY PROTECTIONS&lt;/li&gt;
&lt;li&gt;Now, scroll down to the DEFAULT ROOT OBJECT, type in the name of your HTML file&lt;/li&gt;
&lt;li&gt;Scroll to the end of the page and click on CREATE DISTRIBUTION&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj14d0n8ubsoiwe05ihrv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj14d0n8ubsoiwe05ihrv.png" alt="Image description" width="800" height="354"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click on the CREATE POLICY button&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;STEP 7&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;Back to S3&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Now, go back to S3&lt;/li&gt;
&lt;li&gt;Select the bucket that you created&lt;/li&gt;
&lt;li&gt;Go to PERMISSIONS, go to BLOCK PUBLIC ACCESS, then click on EDIT&lt;/li&gt;
&lt;li&gt;Tick on BLOCK ALL PUBLIC ACCESS&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fse108c32j06zfdfu1mba.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fse108c32j06zfdfu1mba.png" alt="Image description" width="800" height="359"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Click on SAVE CHANGES&lt;/li&gt;
&lt;li&gt;Type CONFIRM in the Modal that pops up&lt;/li&gt;
&lt;li&gt;Then click on the CONFIRM button&lt;/li&gt;
&lt;li&gt;Now, click on EDIT on the BUCKET POLICY&lt;/li&gt;
&lt;li&gt;Paste the policy you copied from CLOUDFRONT&lt;/li&gt;
&lt;li&gt;Click on SAVE CHANGES&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2aaxkz0sgr8icst5kzu5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2aaxkz0sgr8icst5kzu5.png" alt="Image description" width="800" height="353"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Step 8&lt;br&gt;
Back to CloudFront&lt;/p&gt;

&lt;p&gt;Navigate back to CLOUDFRONT&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fup7uekmr7tvz3lspbbuq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fup7uekmr7tvz3lspbbuq.png" alt="Image description" width="800" height="354"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Click on the DISTRIBUTION&lt;/li&gt;
&lt;li&gt;Under GENERAL, locate the DISTRIBUTION DOMAIN NAME under the DETAILS section.&lt;/li&gt;
&lt;li&gt;Copy the DISTRIBUTION DOMAIN NAME &lt;/li&gt;
&lt;li&gt;Now, go back to the tab created from the STATIC WEBSITE HOSTING and refresh&lt;/li&gt;
&lt;li&gt;You will find out that the page isn’t accessible anymore; it will report a 403 FORBIDDEN error message&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now, paste the DISTRIBUTION DOMAIN NAME link on a tab and tap ENTER&lt;/p&gt;

&lt;p&gt;You will realize that our S3 Files are being served through CLOUDFRONT.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe0ront0ycls0pzhmkufp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe0ront0ycls0pzhmkufp.png" alt="Image description" width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Build an End-to-End AWS Web Application</title>
      <dc:creator>Harrison Ifeanyi</dc:creator>
      <pubDate>Fri, 19 Apr 2024 14:55:44 +0000</pubDate>
      <link>https://dev.to/fo_cused/build-an-end-to-end-aws-web-application-579p</link>
      <guid>https://dev.to/fo_cused/build-an-end-to-end-aws-web-application-579p</guid>
      <description>&lt;p&gt;&lt;strong&gt;Building The Power of Math using the following AWS Services:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;AWS Amplify&lt;/li&gt;
&lt;li&gt;AWS Lambda&lt;/li&gt;
&lt;li&gt;Amazon API Gateway&lt;/li&gt;
&lt;li&gt;Amazon DynamoDB&lt;/li&gt;
&lt;li&gt;AWS Identity and Access Management&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Requirements:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create/host the webpage&lt;/li&gt;
&lt;li&gt;Invoke math functionality&lt;/li&gt;
&lt;li&gt;A way to do some math&lt;/li&gt;
&lt;li&gt;Store/return the math result&lt;/li&gt;
&lt;li&gt;Handle permissions&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;TASK 1:&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;A way to create/host the webpage&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;AWS Amplify: It is used to build and host websites&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Created a text document (preferably notepad) named INDEX but saved it as “.html”&lt;/li&gt;
&lt;li&gt;Opened the INDEX.HTML file via Notepad and pasted the POWER OF MATH code in it&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc1lsb6rl4plmrmwgdkdw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc1lsb6rl4plmrmwgdkdw.png" alt="Image description" width="800" height="546"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Once that's done, zip the file&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now, it's time to use AWS Amplify to deploy it&lt;/p&gt;

&lt;p&gt;Log into your AWS Management Console and navigated to the AWS Amplify function&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Under the AWS Amplify Header, click on the GET STARTED button &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Under HOST A WEB APP, click on GET STARTED which takes you to the page below:&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flaplm39g485ksc1oy9vf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flaplm39g485ksc1oy9vf.png" alt="Image description" width="800" height="351"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Select DEPLOY WITHOUT GIT PROVIDER&lt;/li&gt;
&lt;li&gt;Clicked on CONTINUE&lt;/li&gt;
&lt;li&gt;On the MANUAL DEPLOY page, under APP-NAME, I called mine &lt;strong&gt;PowerOfMath&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Under ENVIRONMENT NAME, I typed in DEV&lt;/li&gt;
&lt;li&gt;Drag the zipped file and import it into AWS Amplify&lt;/li&gt;
&lt;li&gt;Click on SAVE and DEPLOY Button&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fla19wslqyxkabyw36ntw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fla19wslqyxkabyw36ntw.png" alt="Image description" width="800" height="359"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It was successfully deployed below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq3ismvxj18ugcoly6mif.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq3ismvxj18ugcoly6mif.png" alt="Image description" width="800" height="355"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Copy the DOMAIN link and open it in a tab&lt;/li&gt;
&lt;li&gt;View the page&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyobbyk9m6o0oh36530kw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyobbyk9m6o0oh36530kw.png" alt="Image description" width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;TASK 2:&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;A way to do some math&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;This is a perfect use case for LAMBDA FUNCTION. This is a piece of code that runs serverless upon some trigger&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;On the AWS Console, navigate to LAMBDA &lt;/li&gt;
&lt;li&gt;Click on CREATE A FUNCTION&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fef3jlip2nue4iy9puctf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fef3jlip2nue4iy9puctf.png" alt="Image description" width="800" height="353"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Under CREATE FUNCTION, select AUTHOR FROM SCRATCH&lt;/li&gt;
&lt;li&gt;Under BASIC INFORMATION;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A. Function Name: I went with &lt;strong&gt;PowerOfMathFunction&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;B. Runtime: I selected &lt;strong&gt;PYTHON 3.9&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Click on the CREATE FUNCTION button&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7r8f8lbbw6hf1e6kw5eg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7r8f8lbbw6hf1e6kw5eg.png" alt="Image description" width="800" height="359"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once it has been created, scroll down the page and paste the PYTHON code written for this function.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1iqd238ax5233u4b1pz2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1iqd238ax5233u4b1pz2.png" alt="Image description" width="800" height="354"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Type CTRL + S to save the code&lt;/li&gt;
&lt;li&gt;Clicked the DEPLOY button&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkmjpq8yraie5j5iiqtu4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkmjpq8yraie5j5iiqtu4.png" alt="Image description" width="800" height="354"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Click on the dropdown icon beside the TEST button&lt;/li&gt;
&lt;li&gt;Click on CONFIGURE TEST EVENT&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6409qsmt950mgoymgyl2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6409qsmt950mgoymgyl2.png" alt="Image description" width="800" height="351"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;On the modal that pops up, choose the CREATE NEW EVENT, I chose to name the event &lt;strong&gt;PowerOfMathTestEvent&lt;/strong&gt;. &lt;/li&gt;
&lt;li&gt;Leave the event-sharing settings on private.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc3aylg7s0rnu1v4yk7k1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc3aylg7s0rnu1v4yk7k1.png" alt="Image description" width="800" height="357"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;On the EVENT JSON section of the modal page, I edited the content made available to the following;&lt;/p&gt;

&lt;p&gt;{&lt;br&gt;
  “base”: 2,&lt;br&gt;
  “exponent”: 8&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;Now, scroll down and clicked the SAVE button&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj4uley4ytxgafq2k3yy8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj4uley4ytxgafq2k3yy8.png" alt="Image description" width="800" height="357"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, click on the DEPLOY button first and the TEST button after&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj2g7lx3kf7m7oj08x0k9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj2g7lx3kf7m7oj08x0k9.png" alt="Image description" width="800" height="344"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It gave the following result:&lt;br&gt;
"statusCode": 200,&lt;br&gt;
  "body": "\"Your result is 256.0\""&lt;/p&gt;

&lt;p&gt;This shows that the LAMBDA FUNCTION is working&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb235s8mxopy7ymodvfwv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb235s8mxopy7ymodvfwv.png" alt="Image description" width="800" height="363"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;TASK 3:&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;A way to invoke the math functionality&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;API Gateway - used to build HTTP, REST &amp;amp; WebSocket APIs&lt;/li&gt;
&lt;li&gt;Navigate to the AWS API Gateway section of the console&lt;/li&gt;
&lt;li&gt;Out of the options displayed, click on the BUILD button under the REST API&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;On the Create REST API page:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Select NEW API&lt;/li&gt;
&lt;li&gt;API Name: PowerOfMathAPI&lt;/li&gt;
&lt;li&gt;I left the API Endpoint Type at REGIONAL&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F89d0z1pw4ptb6ye9uywe.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F89d0z1pw4ptb6ye9uywe.png" alt="Image description" width="800" height="358"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click on the CREATE API button&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn84bjw0lhslpd5yv8rl4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn84bjw0lhslpd5yv8rl4.png" alt="Image description" width="800" height="357"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;On the left side of the screen, ensure that RESOURCES was selected&lt;/li&gt;
&lt;li&gt;Click on the CREATE METHOD button&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;On the CREATE METHOD page;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Under Method type, select POST&lt;/li&gt;
&lt;li&gt;Under Integration type, choose LAMBDA FUNCTION&lt;/li&gt;
&lt;li&gt;Under Lambda function section, I selected the LAMBDA FUNCTION I HAD CREATED FOR THIS PROJECT&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqsafqorfsg9gfv2dtz21.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqsafqorfsg9gfv2dtz21.png" alt="Image description" width="800" height="354"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now clicked on CREATE METHOD&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0qgnczzr9kvf081bwpa8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0qgnczzr9kvf081bwpa8.png" alt="Image description" width="800" height="363"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;At this moment, there is a need to activate Cross-Origin Resources Sharing (CORS) &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;To get that done, click on the “/” icon between CREATE RESOURCES and POST. The CORS button was on the right.&lt;/li&gt;
&lt;li&gt;On the ENABLE CORS page;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcyvzv25034h90unad79l.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcyvzv25034h90unad79l.png" alt="Image description" width="800" height="361"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Under Access-Control-Allow-Methods section, tick the POST option and clicked on the SAVE button&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6ja9kpr1eleth9fedrt2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6ja9kpr1eleth9fedrt2.png" alt="Image description" width="800" height="353"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;At this point, click on the DEPLOY API button&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqi20whjdle8rxodecxma.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqi20whjdle8rxodecxma.png" alt="Image description" width="800" height="359"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Stage: NEW STAGE&lt;/li&gt;
&lt;li&gt;Stage Name: Dev&lt;/li&gt;
&lt;li&gt;Then click on the DEPLOY button&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpfkoabwg1z3yflzz5fb5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpfkoabwg1z3yflzz5fb5.png" alt="Image description" width="800" height="363"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I copied the INVOKE URL and kept it in my notepad for later&lt;/p&gt;

&lt;p&gt;To Test if the API is Working:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Click on RESOURCES&lt;/li&gt;
&lt;li&gt;Select POST &lt;/li&gt;
&lt;li&gt;Select TEST &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd4g99int5f1f2nqiwdh5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd4g99int5f1f2nqiwdh5.png" alt="Image description" width="800" height="360"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I typed in the same equation that was used earlier and the result?&lt;br&gt;
Right below:  &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1jgsmky69uuxbwpp57sa.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1jgsmky69uuxbwpp57sa.png" alt="Image description" width="800" height="358"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;TASK 4:&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;A. Somewhere to store/return the math result&lt;br&gt;
B. Set Permission on the execution role for Lambda&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;DynamoDB - A Key Value, NoSQL Database&lt;br&gt;
IAM: Identity and Access Management&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Navigate to Dynamo DB and clicked on CREATE TABLE&lt;/li&gt;
&lt;li&gt;For Table name, I chose &lt;strong&gt;PowerOfMathDatabase&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;For Partition key, I typed ID&lt;/li&gt;
&lt;li&gt;Click on CREATE TABLE button&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyyn5xdjh0r5514dcx6sp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyyn5xdjh0r5514dcx6sp.png" alt="Image description" width="800" height="356"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Click on the PowerOfMathDatabase&lt;/li&gt;
&lt;li&gt;In the GENERAL INFORMATION section under OVERVIEW, copy the Amazon Resource Name (ARN) and save on your notepad&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;At this point, it was important to ensure that the LAMBDA FUNCTION would be able to write into Dynamo DB&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;So navigate back to the LAMBDA page and click on the CONFIGURATION section&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzhl0ik1ev3as0sqr5gj5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzhl0ik1ev3as0sqr5gj5.png" alt="Image description" width="800" height="357"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click on the URL under ROLE NAME and it opens the IAM page below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz7gnc3f2tmmpz5ahazxv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz7gnc3f2tmmpz5ahazxv.png" alt="Image description" width="800" height="353"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;On this IAM page, click on ADD PERMISSION and chose the CREATE INLINE POLICY&lt;/li&gt;
&lt;li&gt;Click on JSON and paste the EXECUTION ROLE POLICY code&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5ppqbz1p20gropol2xjq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5ppqbz1p20gropol2xjq.png" alt="Image description" width="800" height="356"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Add the DYNAMO DB ARN link that was copied earlier to the RESOURCE part of the code&lt;/li&gt;
&lt;li&gt;Click on the NEXT button&lt;/li&gt;
&lt;li&gt;For Policy name, I chose &lt;strong&gt;PowerOfMath&lt;/strong&gt; and clicked on CREATE POLICY&lt;/li&gt;
&lt;li&gt;Policy Created!&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now, there is a need to update the LAMBDA FUNCTION that writes to the database&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Navigate back to LAMBDA and clicked on CODE&lt;/li&gt;
&lt;li&gt;Under the PowerOfMathFunction Folder, view the PYTHON code you had saved earlier (lambda_function.py)&lt;/li&gt;
&lt;li&gt;I replaced it with the PowerOfMath - LAMBDA FUNCTION FINAL code and pressed CTRL + S to save&lt;/li&gt;
&lt;li&gt;Click on DEPLOY. After it had deployed, clicked on TEST.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpmw8xfauy8ddmrmm92hl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpmw8xfauy8ddmrmm92hl.png" alt="Image description" width="800" height="384"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;TASK 5:&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;Implement a connector by linking AWS Amplify with AWS API Gateway&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I updated the code on the INDEX.HTML file&lt;/li&gt;
&lt;li&gt;I also inputted the API Gateway URL I had copied earlier&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm2znpynnqab6lnpf0p5r.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm2znpynnqab6lnpf0p5r.png" alt="Image description" width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Save the updated file and re-zipped it&lt;/li&gt;
&lt;li&gt;Navigate back to AWS Amplify&lt;/li&gt;
&lt;li&gt;Click on the CHOOSE FILE button, selected the updated INDEX.HTML file and uploaded it&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0jnmlang0352bsx2mxn1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0jnmlang0352bsx2mxn1.png" alt="Image description" width="800" height="356"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, go back to the web tab you had opened with the DOMAIN URL from AWS Amplify&lt;/p&gt;

&lt;p&gt;This was the web page then:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2dk37269nayt79k9mt97.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2dk37269nayt79k9mt97.png" alt="Image description" width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After refreshing, this is the updated and fully functional Power Of Math Page:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0ytxdkgfvw51jho8k5gc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0ytxdkgfvw51jho8k5gc.png" alt="Image description" width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Tested it on a math question:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fstf0quh6gbe4aw2c794s.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fstf0quh6gbe4aw2c794s.png" alt="Image description" width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
