<?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>Forem: Toluwalope Aiyegbusi</title>
    <description>The latest articles on Forem by Toluwalope Aiyegbusi (@tee_aiyegbusi).</description>
    <link>https://forem.com/tee_aiyegbusi</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%2F922879%2F799bab20-552e-48ae-8659-32cb7b743d3f.jpg</url>
      <title>Forem: Toluwalope Aiyegbusi</title>
      <link>https://forem.com/tee_aiyegbusi</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/tee_aiyegbusi"/>
    <language>en</language>
    <item>
      <title>Helmify your React App on EKS</title>
      <dc:creator>Toluwalope Aiyegbusi</dc:creator>
      <pubDate>Thu, 30 Mar 2023 11:40:05 +0000</pubDate>
      <link>https://forem.com/aws-builders/helmify-your-react-app-on-eks-39m5</link>
      <guid>https://forem.com/aws-builders/helmify-your-react-app-on-eks-39m5</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;This article gives a step-by-step explanation of how to deploy a react app using Helm charts on EKS. The react app is a simple app that prints the current date and time. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://helm.sh/" rel="noopener noreferrer"&gt;Helm Chart&lt;/a&gt; is an open-source project owned by Kubernetes. It is Package Manager, Template Engine and Release engine for Kubernetes.&lt;/p&gt;

&lt;h3&gt;
  
  
  Prerequisites
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;An AWS Account and IAM User with necessary role or Admin&lt;/li&gt;
&lt;li&gt;Have docker installed&lt;/li&gt;
&lt;li&gt;Have &lt;a href="https://docs.aws.amazon.com/eks/latest/userguide/eksctl.html" rel="noopener noreferrer"&gt;eksctl&lt;/a&gt; installed. Eksctl is the official command line for EKS&lt;/li&gt;
&lt;li&gt;Have &lt;a href="https://helm.sh/docs/intro/install/" rel="noopener noreferrer"&gt;Helm&lt;/a&gt; installed.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Getting the Application Source Code
&lt;/h3&gt;

&lt;p&gt;Clone the repository for the tutorial.&lt;/p&gt;

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

git clone https://github.com/ToluwalopeAyo/demo-react-app.git


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

&lt;/div&gt;

&lt;p&gt;To run the app locally, switch to the directory, install dependencies and start the app.&lt;/p&gt;

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

cd reactapp
npm install
npm start


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

&lt;/div&gt;

&lt;p&gt;A new tab should open on your browser with the app running.&lt;/p&gt;

&lt;h3&gt;
  
  
  Containerize the App
&lt;/h3&gt;

&lt;p&gt;In the working directory, create a Dockerfile and paste the following. &lt;/p&gt;

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

FROM node:16-alpine
WORKDIR /usr/src/app
COPY package*.json ./
RUN npm install
COPY . .
EXPOSE 3000
CMD [ "npm", "start" ]



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

&lt;/div&gt;

&lt;p&gt;To build the docker image, run the command below. Replace 'name' with a preferable name tag for your docker image.&lt;/p&gt;

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

docker build -t &amp;lt;name&amp;gt; .


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

&lt;/div&gt;
&lt;h3&gt;
  
  
  Push Docker Image to a Container Registry
&lt;/h3&gt;

&lt;p&gt;In this tutorial, we'd use Elastic Container Registry to publish the docker image.&lt;/p&gt;

&lt;p&gt;First, log in to AWS console and search for the Elastic Container Registry Service.&lt;br&gt;
Click on 'Create Repository' to create a repository for the docker image. The repository is to be private and give the repository a name.&lt;/p&gt;

&lt;p&gt;Then, authenticate your docker client with ECR with this command:&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

aws ecr get-login-password --region region | docker login --username AWS --password-stdin aws_account_id.dkr.ecr.region.amazonaws.com


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

&lt;/div&gt;

&lt;p&gt;Replace 'region' and 'aws_account_id' with your AWS region and AWS account id respectively.&lt;br&gt;
You should get a response with the message "Login Succeeded".&lt;/p&gt;

&lt;p&gt;Tag the docker image that was created earlier with the uri of the ecr repository and a verison tag.&lt;/p&gt;

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

docker tag &amp;lt;name&amp;gt; aws_account_id.dkr.ecr.region.amazonaws.com/repository-name


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

&lt;/div&gt;

&lt;p&gt;Push the docker image to ECR&lt;/p&gt;

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

docker push aws_account_id.dkr.ecr.region.amazonaws.com/repository-name


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

&lt;/div&gt;
&lt;h3&gt;
  
  
  Create the EKS Cluster
&lt;/h3&gt;

&lt;p&gt;Using the Eksctl command, create a kubernetes cluster. Replace 'region' with your appropriate region. &lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

eksctl create cluster --name helm-test --region &amp;lt;region&amp;gt; --nodegroup-name linux-nodes --node-type t2.micro --nodes 2


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

&lt;/div&gt;

&lt;p&gt;The cluster should take about 20 mins to create completely.&lt;/p&gt;

&lt;h3&gt;
  
  
  Create the Helm Chart
&lt;/h3&gt;

&lt;p&gt;To create a new chart, run the helm create command in the react-app directory, where 'helm-test' is the name of the chart. This command creates a directory containing the common chart files and directories.&lt;/p&gt;

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

helm create helm-test


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

&lt;/div&gt;

&lt;p&gt;The file structure should look like this:&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%2F2bj3ppz6sl1ggjquja6q.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%2F2bj3ppz6sl1ggjquja6q.png" alt="Helm create command output"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the helm-test folder, delete all the files in the templates folder except the _helpers.tpl file. Also clear the values.yaml file. You can copy the files in a seperate directory for reference.&lt;/p&gt;

&lt;p&gt;In the templates folder, create a deployment.yaml file and paste the code below.&lt;/p&gt;

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

apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "helm-test.fullname" . }}
  labels: 
    # replaces this value with the chart name
    app: {{ include "helm-test.name" . }}
spec:
  # this gets the value of replicas from the values.yaml file
  replicas: {{ .Values.replicaCount }}
  selector:
    matchLabels:
      app: {{ include "helm-test.name" . }}
  template:
    metadata:
      labels:
        app: {{ include "helm-test.name" . }}
    spec:
      containers:
      - name: {{ .Chart.Name }}
        # gets the image repository value from the values.yaml file
        image: {{ .Values.image.repository }}
        imagePullPolicy: {{ .Values.image.pullPolicy}}
        ports:
        - containerPort: 3000



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

&lt;/div&gt;

&lt;p&gt;In the templates folder, create a svc.yaml file and paste the code below.&lt;/p&gt;

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

apiVersion: v1
kind: Service
metadata:
  labels:
    app: {{ include "helm-test.name" . }}
  name: {{ include "helm-test.name" .}}
spec:
  type: {{ .Values.service.type }}
  selector:
    app: {{ include "helm-test.name" .}}
  ports:
  - port: {{ .Values.service.port }}
    targetPort: {{ .Values.service.targetPort }}


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

&lt;/div&gt;

&lt;p&gt;In the values.yml file, paste the code below. Make sure to replace 'aws_account_id', 'region' and 'repository-name' with the appropriate value.&lt;/p&gt;

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

replicaCount: 1

image:
  repository: &amp;lt;aws_account_id&amp;gt;.dkr.ecr.&amp;lt;region&amp;gt;.amazonaws.com/&amp;lt;repository-name&amp;gt;:latest
  pullPolicy: IfNotPresent

service: 
  port: 80
  targetPort: 3000
  # The service type is a LoadBalancer so that we can access it from the browser
  type: LoadBalancer


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

&lt;/div&gt;

&lt;p&gt;Run the &lt;code&gt;helm lint .&lt;/code&gt; command to be sure that the charts are well formatted. The output should look like this:&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%2Ff7jnk67ckrsg41iuaje5.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%2Ff7jnk67ckrsg41iuaje5.png" alt="Helm lint output"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Deploying the Helm Charts to Kubernetes
&lt;/h3&gt;

&lt;p&gt;To deploy the helm chart to kubernetes, run the 'helm install' command&lt;/p&gt;

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

helm install helm-test .


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

&lt;/div&gt;

&lt;p&gt;The output should look like this:&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%2Fuh8nma2ff287qftaki1q.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%2Fuh8nma2ff287qftaki1q.png" alt="helm install output"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To confirm that the app was successfully deployed, run the kubectl get pods and get svc command.&lt;/p&gt;

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

kubectl get pods


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

&lt;/div&gt;

&lt;p&gt;The pod should be running&lt;br&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%2Fjic61ofpvfape5xmgzxx.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%2Fjic61ofpvfape5xmgzxx.png" alt="kubectl get pods output"&gt;&lt;/a&gt;&lt;/p&gt;

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

kubectl get svc


&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%2Fkcbk6nf3xs7ly7jdprns.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%2Fkcbk6nf3xs7ly7jdprns.png" alt="kubectl get svc output"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Copy the endpoint in the External IP and paste on your browser using http and you should see that the app is running.&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%2F0pf3z0iy4wwvi4v9l0j2.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%2F0pf3z0iy4wwvi4v9l0j2.png" alt="App running on the browser"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;In this article, we learnt how to use Helm Charts to deploy a react app to Kubernetes. &lt;/p&gt;

&lt;p&gt;In order not to incur charges on AWS, please make sure to delete the EKS cluster. &lt;br&gt;
First delete the helm chart.&lt;/p&gt;

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

helm uninstall helm-test


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

&lt;/div&gt;

&lt;p&gt;Then delete the cluster.&lt;/p&gt;

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

eksctl delete cluster --name helm-test --region &amp;lt;region&amp;gt;


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

&lt;/div&gt;

&lt;p&gt;Thank you&lt;/p&gt;

</description>
      <category>kubernetes</category>
      <category>helm</category>
      <category>aws</category>
    </item>
    <item>
      <title>Ansible as a Provisioning tool: Creating a VPC</title>
      <dc:creator>Toluwalope Aiyegbusi</dc:creator>
      <pubDate>Tue, 28 Mar 2023 22:23:42 +0000</pubDate>
      <link>https://forem.com/aws-builders/ansible-as-a-provisioning-tool-creating-a-vpc-4kim</link>
      <guid>https://forem.com/aws-builders/ansible-as-a-provisioning-tool-creating-a-vpc-4kim</guid>
      <description>&lt;h3&gt;
  
  
  Introduction
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;a href="https://www.ansible.com/"&gt;Ansible&lt;/a&gt; is an open-source command-line IT automation software application sponsored by RedHat. &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;It is mostly used as a server configuration management tool, network automation tool and can also be used for provisioning &lt;br&gt;
several services like kubernetes, nginx and services across several cloud platforms. Check the official documentation to see a &lt;a href="https://docs.ansible.com/ansible/latest/collections/index.html"&gt;list supported services&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;This article gives a run-down of how to build an AWS VPC without having to use the AWS console using Ansible. The VPC would contain a private and public subnet, internet gateway for the public subnet, a Nat gateway for the private subnet, and route tables.&lt;/p&gt;
&lt;h4&gt;
  
  
  Prerequisites
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;An AWS account&lt;/li&gt;
&lt;li&gt;An AWS user with an IAM role that has the necessary permissions to create resources, mostly an admin role.&lt;/li&gt;
&lt;li&gt;Should have ansible installed. &lt;a href="https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html"&gt;Click here for installation guide&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;
  
  
  Setting up the project directory
&lt;/h4&gt;

&lt;p&gt;Create a directory where you would have your project set up. In the working directory,create a network.yml file and a vars folder with a main.yml file in it. The vars folder will contain environment variables. Your directory structure should look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;├── network.yml
└── vars
    └── main.yml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Variables
&lt;/h4&gt;

&lt;p&gt;The use of variables is to ensure flexibility within the main playbook in case of repeated values and you can easily modify values without modifying the main file.&lt;br&gt;
Copy and paste this into the main.yml file in the vars folder. Make sure to replace the "aws_secret_key" and "aws_access_key" with yours. Although it is not advisable to hard code secret keys into variable files, check the &lt;a href="https://docs.ansible.com/ansible/latest/collections/amazon/aws/docsite/guide_aws.html#authentication"&gt;documentation&lt;/a&gt; on how to use best practices to store credentials&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;aws_secret_key: ""
aws_access_key: ""
region: us-east-1 
vpc_cidr: 10.1.0.0/16
public_subnet_cidr: 10.1.1.0/24
private_subnet_cidr: 10.1.2.0/24
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Creating the VPC
&lt;/h4&gt;

&lt;p&gt;Copy and paste this code into the network.yml file&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;- name: Create VPC and Subnets
  hosts: localhost
  # This is to make sure the playbook references the variables in the vars folder
  vars_files:
    - vars/main.yml
  module_defaults:
    group/aws:
      aws_secret_key: "{{ aws_secret_key }}"
      aws_access_key: "{{ aws_access_key }}"

  tasks:
    - name: Create a VPC
      amazon.aws.ec2_vpc_net:
        name: test
        state: present
        cidr_block: "{{ vpc_cidr }}"
        region: "{{ region }}"
        dns_hostnames: true
        dns_support: true
        tags:
          key: name
          value: dev
      # the 'register' keyword here is to register the module returned data in the 'vpc_name' variable
      register: vpc_name

    - name: Create Public Subnet
      amazon.aws.ec2_vpc_subnet:
        state: present
        vpc_id: "{{ vpc_name.vpc.id }}"
        region: "{{ region }}"
        cidr: "{{ public_subnet_cidr }}"
        map_public: true
      register: public_sub

    - name: Create Private Subnet
      amazon.aws.ec2_vpc_subnet:
        state: present
        vpc_id: "{{ vpc_name.vpc.id }}"
        region: "{{ region }}"
        cidr: "{{ private_subnet_cidr }}"
        map_public: true
      register: private_subnet

    - name: Create Internet Gateway
      amazon.aws.ec2_vpc_igw:
        vpc_id: "{{ vpc_name.vpc.id }}"
        region: "{{ region }}"
        state: present
      register: igw

    - name: Public Subnet Route Table
      amazon.aws.ec2_vpc_route_table:
        vpc_id: "{{ vpc_name.vpc.id }}"
        region: "{{ region }}"
        subnets:
          - "{{ public_sub.subnet.id }}"
        routes:
          - dest: 0.0.0.0/0
            gateway_id: "{{ igw.gateway_id }}"
      register: public_route_table

    - name: Elastic IP for Nat gateway
      amazon.aws.ec2_eip:
        region: "{{ region }}"
        state: present
      register: eip

    - name: Network gateway
      amazon.aws.ec2_vpc_nat_gateway:
        state: present
        subnet_id: "{{ private_subnet.subnet.id }}"
        eip_address: "{{ eip.public_ip }}"
        region: "{{ region }}"
        wait: true
      register: nat

    - name: Private subnet route table
      amazon.aws.ec2_vpc_route_table:
        vpc_id: "{{ vpc_name.vpc.id }}"
        region: "{{ region }}"
        subnets:
          - "{{ private_subnet.subnet.id }}"
        routes:
          - dest: 0.0.0.0/0
            gateway_id: "{{ nat.nat_gateway_id }}"

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

&lt;/div&gt;



&lt;h4&gt;
  
  
  Run the playbook
&lt;/h4&gt;

&lt;p&gt;Open the terminal in the working directory and run the command&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ansible-playbook network.yml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The output should look like this&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;PLAY [Create VPC and Subnets] **************************************

TASK [Gathering Facts] *********************************************
ok: [localhost]

TASK [Create a VPC] ************************************************
changed: [localhost]

TASK [Create Public Subnet] ****************************************
changed: [localhost]

TASK [Create Private Subnet] ***************************************
changed: [localhost]

TASK [Create Internet Gateway] *************************************
changed: [localhost]

TASK [Public Route Table] ******************************************
changed: [localhost]

TASK [Elastic IP for Nat gateway] **********************************
changed: [localhost]

TASK [Network gateway] *********************************************
changed: [localhost]

TASK [Private subnet route table] **********************************
changed: [localhost]

PLAY RECAP *********************************************************
localhost                  : ok=9    changed=8    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can log in to the AWS console and be sure it created successfully&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--QFEKPENT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4z79t0oprdh9hqmpgey6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--QFEKPENT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4z79t0oprdh9hqmpgey6.png" alt="AWS Console showing VPC created with Ansible" width="880" height="323"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;That's it on how to use Ansible to create a VPC. In my next article, I'll show how to delete the resources created using Ansible.&lt;/p&gt;

</description>
      <category>devops</category>
      <category>aws</category>
      <category>ansible</category>
    </item>
  </channel>
</rss>
