<?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: Victor Modebe</title>
    <description>The latest articles on Forem by Victor Modebe (@victordgr8t).</description>
    <link>https://forem.com/victordgr8t</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%2F934013%2Ffae8fb98-524c-42fb-9d30-59264e5260f6.png</url>
      <title>Forem: Victor Modebe</title>
      <link>https://forem.com/victordgr8t</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/victordgr8t"/>
    <language>en</language>
    <item>
      <title>Create a Private Docker REPO on AWS ECR</title>
      <dc:creator>Victor Modebe</dc:creator>
      <pubDate>Wed, 18 Jan 2023 09:15:56 +0000</pubDate>
      <link>https://forem.com/victordgr8t/create-a-private-docker-repo-on-aws-ecr-1l8</link>
      <guid>https://forem.com/victordgr8t/create-a-private-docker-repo-on-aws-ecr-1l8</guid>
      <description>&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%2Fihmklxtn6wnlwhz7bj6w.jpeg" 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%2Fihmklxtn6wnlwhz7bj6w.jpeg" alt="AWS ECR + DOCKER REPO" width="337" height="149"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Greetings, In this blog post I will demonstrate how to Create a private docker repository on amazon elastic container registry (ECR).&lt;/p&gt;

&lt;p&gt;Creating a private Docker repository on Amazon Elastic Container Registry (ECR) allows you to securely store and manage your Docker images. &lt;br&gt;
In this blog post, we will cover the steps to create a private Docker repository on Amazon ECR and how to push and pull images to and from the repository created.&lt;/p&gt;

&lt;p&gt;&lt;u&gt;&lt;strong&gt;Requirements for this tutorial&lt;/strong&gt;&lt;/u&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;An AWS account: You will need to have an AWS account in order to access the ECR service.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;IAM user with appropriate permissions: You will need to have an IAM user that has the necessary permissions to create and manage ECR repositories and images. This will typically include permissions such as ecr:CreateRepository, ecr:ListImages, ecr:DescribeRepositories, ecr:PutImage, and ecr:GetAuthorizationToken.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Docker installed on your machine: You will need to have Docker installed on your machine in order to interact with the ECR repository using the Docker command-line interface.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;AWS CLI installed on your machine: You will need to have AWS CLI installed on your machine to perform the authentication step.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It is also good to have some knowledge of the basics of Docker and AWS, as well as experience working with the command-line interface to be able to follow through with this tutorial.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;That being said lets deep dive into the tutorial which is described in several steps.&lt;/p&gt;

&lt;p&gt;&lt;u&gt;&lt;strong&gt;Step 1: Create an Amazon ECR Repository&lt;/strong&gt;&lt;/u&gt;&lt;/p&gt;

&lt;p&gt;Log in to the AWS Management Console and navigate to ECR.&lt;br&gt;
Click on the "Create repository" button.&lt;br&gt;
Give your repository a name and click on the "Create repository" button.&lt;br&gt;
Step 2: Authenticate Docker to Your AWS Account&lt;/p&gt;

&lt;p&gt;Run the following command in your terminal to authenticate Docker to your AWS account:&lt;br&gt;
&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 &amp;lt;your-region&amp;gt; | docker login --username AWS --password-stdin &amp;lt;your-account-id&amp;gt;.dkr.ecr.&amp;lt;your-region&amp;gt;.amazonaws.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;&lt;u&gt;Step 3: Tag Your Docker Image&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Run the following command to tag your Docker image with the repository name and the tag you want to use. Replace the placeholders with your own values:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker tag &amp;lt;image-name&amp;gt; &amp;lt;your-account-id&amp;gt;.dkr.ecr.&amp;lt;your-region&amp;gt;.amazonaws.com/&amp;lt;repository-name&amp;gt;:&amp;lt;tag&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;&lt;u&gt;Step 4: Push the Image to the Repository&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Run the following command to push the image to the repository:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker push &amp;lt;your-account-id&amp;gt;.dkr.ecr.&amp;lt;your-region&amp;gt;.amazonaws.com/&amp;lt;repository-name&amp;gt;:&amp;lt;tag&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Step 5: Pulling Images from the Repository&lt;/p&gt;

&lt;p&gt;Run the following command to pull an image from the repository:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker pull &amp;lt;your-account-id&amp;gt;.dkr.ecr.&amp;lt;your-region&amp;gt;.amazonaws.com/&amp;lt;repository-name&amp;gt;:&amp;lt;tag&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once you've followed these steps, your private Docker repository on Amazon ECR is set up and ready to use. You can push and pull images to and from the repository as needed. Keep in mind that only users with the appropriate permissions will be able to access and manage the images in your private repository.&lt;/p&gt;

&lt;p&gt;In addition, you can use AWS CLI or SDKs to automate the process of creating and managing repositories, images, and permissions.&lt;/p&gt;

&lt;p&gt;In this way, you can easily create a private Docker repository on Amazon ECR and manage your Docker images with more security and flexibility.&lt;/p&gt;

&lt;p&gt;Thanks for reading hope this helps someone...&lt;/p&gt;

</description>
      <category>docker</category>
      <category>programming</category>
      <category>aws</category>
      <category>devops</category>
    </item>
    <item>
      <title>SEND TEXT MESSAGES USING AMAZON SNS WITH PYTHON (Boto3)</title>
      <dc:creator>Victor Modebe</dc:creator>
      <pubDate>Mon, 19 Dec 2022 17:42:37 +0000</pubDate>
      <link>https://forem.com/victordgr8t/send-text-messages-using-amazon-sns-python-1l04</link>
      <guid>https://forem.com/victordgr8t/send-text-messages-using-amazon-sns-python-1l04</guid>
      <description>&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%2Fh14y5mnso26jqoz51oj6.jpg" 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%2Fh14y5mnso26jqoz51oj6.jpg" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Greetings guys!!! I will show you how to send SMS messages to a phone number using Amazon Simple Notification Service (SNS) and Python. &lt;/p&gt;

&lt;p&gt;Before we start I will introduce you to the services we will use for this tutorial. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Introduction&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Amazon Simple Notification Service (SNS) is a fully managed messaging service that enables you to send messages to all devices (such as iOS, Android, and Fire OS devices) and email clients. It is a flexible, cost-effective way to send SMS messages, and it can be integrated with other AWS services such as Amazon Lambda and Amazon CloudWatch.&lt;/p&gt;

&lt;p&gt;In this tutorial, I will show you how to send SMS messages to a phone number using Python and the AWS SDK for Python (Boto3).&lt;/p&gt;

&lt;p&gt;Boto3 is the Amazon Web Services (AWS) Software Development Kit (SDK) for Python, which allows Python developers to write software that makes use of services like Amazon S3 and Amazon EC2.&lt;/p&gt;

&lt;p&gt;Boto3 provides a convenient and easy-to-use API for interacting with AWS services such as Amazon SNS, Amazon S3, and Amazon EC2. It is built on top of the AWS HTTP API and provides a Pythonic interface to AWS services. With Boto3, you can write Python scripts to manage and automate AWS resources, as well as customize the behavior of AWS services.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Prerequisites&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Before you begin, make sure you have the following:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;An AWS account. If you don't have one, you can create one for free at aws.amazon.com.&lt;/li&gt;
&lt;li&gt;Python 3.10.9 or latest version. You can check your Python version by running the following command: python -V&lt;/li&gt;
&lt;li&gt;The AWS CLI (Command Line Interface) installed and configured on your machine.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Setting up Amazon CLI&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The AWS Command Line Interface (CLI) is a unified tool used to manage your AWS services. With the AWS CLI, you can control multiple AWS services from the command line, and automate them through scripts.&lt;/p&gt;

&lt;p&gt;To set up the AWS CLI on your machine, follow these steps:&lt;/p&gt;

&lt;p&gt;Install Python 3.10.9 or latest version. You can check your Python version by running the following command:&lt;/p&gt;

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

$ python3 --version


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

&lt;/div&gt;

&lt;p&gt;Install pip, the Python package manager. You can install pip by running the following command:&lt;/p&gt;

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

$ python3 -m ensurepip


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

&lt;/div&gt;

&lt;p&gt;Install the AWS CLI. You can install the AWS CLI by running the following command: &lt;/p&gt;

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

$ pip3 install awscli


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

&lt;/div&gt;

&lt;p&gt;Configure the AWS CLI. You can configure the AWS CLI by running the aws configure command and following the prompts. You will need to provide your AWS access key and secret key, as well as the default region and output format. You can obtain your access key and secret key by signing in to the AWS Management Console and navigating to the IAM (Identity and Access Management) dashboard.&lt;/p&gt;

&lt;p&gt;After you have installed and configured the AWS CLI, you can use it to manage your AWS resources from the command line. For example, to list all the S3 buckets in your account, you can use the  command:&lt;/p&gt;

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

$ aws s3 ls


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

&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Setting up Amazon SNS&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To send an SMS message using Amazon SNS, you need to set up in several ways. &lt;br&gt;
Find below two steps to setup Amazon SNS. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;login to your aws account, &lt;/li&gt;
&lt;li&gt;then type in sns on the search bar. &lt;/li&gt;
&lt;li&gt;Click menu bar on the left &lt;/li&gt;
&lt;li&gt;Scroll down to Mobile then click 'Text messaging (SMS)'&lt;/li&gt;
&lt;li&gt;Scroll down and click add phone number.&lt;/li&gt;
&lt;li&gt;Add your phone number and select a language the verification message will be sent in, then add phone number.&lt;/li&gt;
&lt;li&gt;Input the verification code and then click verify phone number
If done correctly you should see your number as verified below&lt;/li&gt;
&lt;/ul&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%2F65b76qzv4n5zl2ypw0ma.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%2F65b76qzv4n5zl2ypw0ma.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 2&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Sign in to the AWS Management Console and navigate to the Amazon SNS dashboard.&lt;/li&gt;
&lt;li&gt;Click the Create topic button.&lt;/li&gt;
&lt;li&gt;Enter a Topic name and a Display name for your topic, and then click the Create topic button.&lt;/li&gt;
&lt;li&gt;In the Subscriptions tab, click the Create subscription button.&lt;/li&gt;
&lt;li&gt;Select SMS as the Protocol and enter the phone number that you want to subscribe to the topic.&lt;/li&gt;
&lt;li&gt;Click the Create subscription button to subscribe the phone number to the topic.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Sending SMS messages with Python&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Now that you have set up an SNS topic and subscribed a phone number to the topic, you can use Python and the Boto3 library to send SMS messages to the phone number.&lt;/p&gt;

&lt;p&gt;First, install the Boto3 library by running the following command:&lt;/p&gt;

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

$ pip3 install boto3



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

&lt;/div&gt;

&lt;p&gt;Next, create a Python script and import the boto3 library. Then, create an SNS client using the following code:&lt;/p&gt;

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

import boto3

# Create an SNS client
sns_client = boto3.client('sns')



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

&lt;/div&gt;

&lt;p&gt;create three variables one for phone number and the other for message. Add the contents of your message and the actual phone number that will receive the message in the defined variables.&lt;/p&gt;

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

phone_number = '+1234567890'
message = "This is a test message sent from Nnamdi using Amazon SNS and python."
# Set the topic ARN that the phone number is subscribed to
topic_arn = 'arn:aws:sns:us-east-1:123456789012:MyTopic'



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

&lt;/div&gt;

&lt;p&gt;To send an SMS message, you can use the publish() method of the client object. The publish() method requires the following parameters:&lt;/p&gt;

&lt;p&gt;PhoneNumber: The phone number to which you want to send the SMS message.&lt;br&gt;
Message: The content of the SMS message.&lt;br&gt;
TopicArn: A unique identifier for a topic in the Amazon Simple Notification Service (SNS). A topic is a logical access point and communication channel for allowing messages to be published to subscribing endpoints or clients.&lt;/p&gt;

&lt;p&gt;Here is an example of how to send an SMS message using the publish() method:&lt;/p&gt;

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

# Send the SMS message
response = sns.publish(
    PhoneNumber=phone_number,
    Message=message,
    TopicArn=topic_arn
)


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

&lt;/div&gt;

&lt;p&gt;Next and final step print out the code which will notify you a response if the message fails or sends successfully. It will also display the message ID&lt;/p&gt;

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

print(f"Message sent! Message ID: {response['MessageId']}")


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

&lt;/div&gt;

&lt;p&gt;This will send the SMS message to the phone number that is subscribed to the specified SNS topic.&lt;/p&gt;

&lt;p&gt;Note that the phone number that you are sending the SMS message to must be subscribed to the SNS topic that you are specifying in the TopicArn parameter.&lt;/p&gt;

&lt;p&gt;Alternatively you can choose to send to the verified number I showed you earlier and take out the SNS TopicArn line of code like below&lt;/p&gt;

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

phone_number = '+1234567890'  # add recipients phone number here
message = "Test Message from nnamdi"  # add message here

# Send the message
response = sns_client.publish(
    PhoneNumber=phone_number,
    Message=message
)


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

&lt;/div&gt;

&lt;p&gt;You should get the prompt below if you followed the process correctly.&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%2Fvcmdsuke2q3iopuvp5ew.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%2Fvcmdsuke2q3iopuvp5ew.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;NB:&lt;/strong&gt; The number we verified is in the SMS Sandbox in US East(North Virginia) region. When in the sandbox, you can only deliver SMS to the sandbox destination phone numbers you have verified.&lt;br&gt;
When your account is moved out of the sandbox, these restrictions are removed, and you can send SMS messages to any recipient.&lt;br&gt;
To move your account out of the sandbox click the link to get detailed steps from AWS &lt;a href="https://docs.aws.amazon.com/sns/latest/dg/sns-sms-sandbox-moving-to-production.html" rel="noopener noreferrer"&gt;AMAZON SNS SMS SANDBOX DOCUMENT&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I hope this helps!!!&lt;/p&gt;

&lt;p&gt;You can get the python script from my GitHub repo&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/victordgr8t/python-projects/tree/main/send_sms" rel="noopener noreferrer"&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%2F6v7bex52kadwu7nopjt9.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>python</category>
      <category>sns</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Launching a VPC with Public subnet and Private subnet in AWS using Terraform</title>
      <dc:creator>Victor Modebe</dc:creator>
      <pubDate>Sat, 17 Dec 2022 10:00:43 +0000</pubDate>
      <link>https://forem.com/victordgr8t/launching-a-vpc-with-public-subnet-and-private-subnet-in-aws-using-terraform-5976</link>
      <guid>https://forem.com/victordgr8t/launching-a-vpc-with-public-subnet-and-private-subnet-in-aws-using-terraform-5976</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.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%2Fph8prp17m1834x2yhzu6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fph8prp17m1834x2yhzu6.png" alt="Image description" width="800" height="599"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this blog post I will launch a VPC and configure it with 2 subnets, one public and one private. A WORDPRESS EC2 instance will be created in the public subnet while a MYSQL instance will be created in the private subnet. I will create a Bastion host or jump box which will allow SSH connections to the MYSQL instance which is created in the private subnet. It is best practice when creating a multi-tier website with web server in public subnets and database server in private subnet so no one can have access to it since its private.  &lt;/p&gt;

&lt;p&gt;For this tutorial the wordpress will be a public facing application while the MYSQL will be the backend database server.&lt;br&gt;
I will use visual studio code.&lt;/p&gt;

&lt;p&gt;Long long ago, writing codes for all the infrastructure for  testing, debugging and deploying would have consumed a good amount of valuable time. It is really difficult to tell which infrastructure as code tool was first created and released but in the early- to mid- 2000's Chef, Puppet and Ansible were first released. These tools allowed users to define and manage their infrastructure using configuration files, which enabled them to automate the provisioning and management of their infrastructure in a repeatable and predictable way. AWESOME!!! discovery right??? I read your mind LOL!!!&lt;/p&gt;

&lt;p&gt;Over time, the concept of infrastructure as code has continued to evolve, and more specialized tools like Terraform, CloudFormation, and ARM Templates have been developed to help users manage their infrastructure more effectively. These tools provide a higher-level abstraction for defining infrastructure, and they often integrate with other tools and services to provide a more comprehensive infrastructure as code solution.&lt;/p&gt;

&lt;p&gt;For this blog post we will use Terraform because it has several advantages over other IaC tool the major reason being that it is cloud agnostic which means it can be used to manage infrastructure on various cloud and on-premises platforms.&lt;br&gt;
This makes it easy for organizations to use a single tool to manage their infrastructure across different environments, and avoid vendor lock-in. &lt;br&gt;
you can read more about terraform here &lt;br&gt;
&lt;a href="https://terraform.io/" rel="noopener noreferrer"&gt;&lt;img src="https://media2.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%2F83cfvgrjm40rziqvthtm.png" alt="Image description" width="720" height="480"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this blog post I will guide you to construct the pipeline described in the first paragraph of this blog.&lt;/p&gt;

&lt;p&gt;Life these days is all about automation, which makes living much more easy. Productivity has increased by a large margin, tech companies delivery services much more faster as compared to the early years of software development. It will only get better and faster with Artificial Intelligence and Machine learning. What a future we have ahead of us. &lt;/p&gt;
&lt;h2&gt;
  
  
  &lt;strong&gt;Prerequisites to implement this pipeline&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1.&lt;/strong&gt; Some knowledge of AWS &amp;amp; Github.&lt;br&gt;
 &lt;strong&gt;2.&lt;/strong&gt; You need to have some knowledge of JSON, arghh!!! me too, not to worry, I will simplify as much as possible. In this Pipeline, terraform is written in HCL (HashiCorp Configuration Language) &amp;amp; it is quite similar to JSON. Hence you will need basic knowledge of terraform&lt;br&gt;
&lt;strong&gt;3.&lt;/strong&gt; Basic knowledge of Docker is required &lt;br&gt;
&lt;strong&gt;4.&lt;/strong&gt; You will need to install AWS CLI &amp;amp; terraform&lt;/p&gt;

&lt;p&gt;We are definitely making progress :) now I will list the steps required to automate the process described above using terraform. Watch and learn how will terraform bring to life the infrastructure we have described above with codes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Steps to provision the infrastructure&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;1&lt;/strong&gt;. Create a var.tf, provider.tf, main.tf, vpc.tf and output.tf files. this is where we will write our codes.&lt;br&gt;
&lt;strong&gt;2&lt;/strong&gt;. Create a provider inside provider.tf file.&lt;br&gt;
&lt;strong&gt;3&lt;/strong&gt;. Create an AWS key pair inside main.tf file.&lt;br&gt;
&lt;strong&gt;4&lt;/strong&gt;. Create a VPC (Virtual Private Cloud in AWS) inside vpc.tf file.&lt;br&gt;
&lt;strong&gt;5&lt;/strong&gt;. Create public and private subnet with map public ip on launch set to true inside vpc.tf file.&lt;br&gt;
&lt;strong&gt;6&lt;/strong&gt;. Create an Internet Gateway for Instances in the public subnet to access the Internet.&lt;br&gt;
&lt;strong&gt;7&lt;/strong&gt;. Create a route table that allows traffic to be routed through the Internet Gateway.&lt;br&gt;
&lt;strong&gt;8&lt;/strong&gt;. Create an association the route which will associate the route table to the public internet.&lt;br&gt;
&lt;strong&gt;9&lt;/strong&gt;. Create a Security Group and EC2 Instance for the Bastion Host.&lt;br&gt;
&lt;strong&gt;10&lt;/strong&gt;. Create a Security Group and EC2 Instance for the Wordpress .&lt;br&gt;
&lt;strong&gt;11&lt;/strong&gt;. Create a Security Group and EC2 Instance for the MYSQL Database.&lt;br&gt;
&lt;strong&gt;12&lt;/strong&gt;. Validate, plan &amp;amp; apply our Terraform configuration code.&lt;br&gt;
&lt;strong&gt;13&lt;/strong&gt;. Connect to the instances created and test SSH connection.&lt;br&gt;
&lt;strong&gt;14&lt;/strong&gt;. Create an outputs.tf file and input some code to display the resource id.&lt;br&gt;
&lt;strong&gt;15&lt;/strong&gt;. Launch a Bastion Host.&lt;br&gt;
&lt;strong&gt;16&lt;/strong&gt;. Final step configure Wordpress and upload some images.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1&lt;/strong&gt;&lt;br&gt;
I will create a var.tf file where I will store all my variables. You can add any variable you want just remember to call the variable when you need it. which I will show in later steps.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#create variable, specify type and set to default
#create variable, specify type and set to default
variable "awsprops" {
  type = map(any)
  default = {
    region       = "us-east-1"
    ami          = "ami-0b0dcb5067f052a63"
    instancetype = "t2.micro"
    az1          = "us-east-1a"
    az2          = "us-east-1b"
  }
}

# key variable for refrencing 
variable "keyname" {
  default = "NV_R_key"
}

# base_path for refrencing 
variable "base_path" {
  default = "/Users/mac/Desktop/terraform-projects/"
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 2&lt;/strong&gt; &lt;br&gt;
I will create  a provider. Notice how I called up region by using 'var.awsprops' which I defined in the variable file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#create provider and specify provider name
provider "aws" {
  region = lookup(var.awsprops, "region")
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 3&lt;/strong&gt;&lt;br&gt;
I will create an AWS Key pair. &lt;br&gt;
To authenticate with the remote host, you would need to have a copy of the corresponding public key, which you would typically add to your ~/.ssh/authorized_keys file on the client machine.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#this will create key with RSA algorithm and 4096 rsa bits
resource "tls_private_key" "private_key" {
  algorithm = "RSA"
  rsa_bits  = 4096
}
#this will create a key pair using the private key defined above  
resource "aws_key_pair" "Key-Pair" {
  key_name   = lookup(var.awsprops, "keyname")  # key name
  public_key = pls_private_key.private_key.public_key_openssh

 }

# this terraform resource will save private key at specified path.
resource "local_file" "storekey" {
  content = tls_private_key.private_key.private_key_pem
  filename = "${var.base_path}${var.key_name}.pem"
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 4&lt;/strong&gt;&lt;br&gt;
In this step we will be creating the backbone of this infrastructure called Virtual Private Cloud (VPC). We will use 10.0.0.0/16 CIDR block and enable DNS hostname, which is used to enable automatic of assignment of public DNS hostname to EC2 Instances.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#create a VPC and define the ip range
resource "aws_vpc" "prod_vpc" {
  cidr_block           = "10.0.0.0/16" #ip range for the vpc
  enable_dns_hostnames = true 

  tags = {
    Name = "Production_VPC"
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 5&lt;/strong&gt;&lt;br&gt;
In this step we will create subnets. One will be public and the other private. Here map_public_ip_on_launch is set to true which will automatically assign a public ip to the instance when launched.&lt;br&gt;
In Terraform, the depends_on meta-argument can be used to specify that one resource depends on another resource. This means that the specified resource(s) will be created before the resource that specifies the depends_on argument.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#create public subnet
resource "aws_subnet" "prod_public_subnet" {
  depends_on = [aws_vpc.prod_vpc]

  vpc_id                  = aws_vpc.prod_vpc.id
  availability_zone       = lookup(var.awsprops, "az1")
  cidr_block              = "10.0.1.0/24"
  map_public_ip_on_launch = true #connect public subnet to the internet

  tags = {
    Name = "Public_Subnet_PROD"
  }
}

#create private subnet
resource "aws_subnet" "prod_private_subnet" {
  depends_on = [aws_vpc.prod_vpc] 

  vpc_id            = aws_vpc.prod_vpc.id
  availability_zone = lookup(var.awsprops, "az2")
  cidr_block        = "10.0.2.0/24"

  tags = {
    Name = "Private_Subnet_PROD"
  }
}

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 6&lt;/strong&gt;&lt;br&gt;
In this step we will create the internet gateway. The internet gateway is a VPC component that enables instances in the VPC to connect to the public internet&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#create an internet gateway for the vpc
resource "aws_internet_gateway" "prod_igw" {
  depends_on = [aws_vpc.prod_vpc]
  vpc_id = aws_vpc.prod_vpc.id
  tags = {
    Name = "prod-igw"
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 7&lt;/strong&gt;&lt;br&gt;
Here we will create a route table. This will create a route in the VPC's main route table that allows traffic with a destination of 0.0.0.0/0 (i.e., all destinations) to be routed through the Internet Gateway. This will allow instances in the VPC to access the internet.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#create a route table which targets the internet gateway
resource "aws_route_table" "prod_igw_rt" {
  depends_on = [aws_vpc.prod_vpc,
  aws_internet_gateway.prod_igw]

  vpc_id = aws_vpc.prod_vpc.id

  #set default ipv4 route to use the internet gateway
  route {
    cidr_block = "0.0.0.0/0"
    gateway_id = aws_internet_gateway.prod_igw.id
  }
  tags = {
    Name = "Prod-Route-Table"
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 8&lt;/strong&gt;&lt;br&gt;
In this step we will create route table associations which will associate the route table to the public subnet&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#here we create the route table association to the Public subnet
resource "aws_route_table_association" "associate_prod_rt_public_subnet" {
  depends_on = [aws_subnet.prod_public_subnet,
    aws_route_table.prod_igw_rt]

  subnet_id      = aws_subnet.prod_public_subnet.id
  route_table_id = aws_route_table.prod_igw_rt.id
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 9&lt;/strong&gt;&lt;br&gt;
In this step we will create a security group for the bastion host and launch an EC2 instance for the Bastian host as well. A bastion host is a special server on a network specifically designed and configured to withstand attacks. It is typically used to control access to a private network from an external network, such as the internet.&lt;/p&gt;

&lt;p&gt;We will launch a bastion host in the public subnet and from there we SSH into our instances located in the private subnet.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;resource "aws_security_group" "bastion-sg" {
  depends_on = [aws_vpc.prod_vpc] #this means the vpc resource will be created before the bastion host sg

  name        = "Bastion_Host_SG"
  description = "Security Group for Bastion Host"
  vpc_id      = aws_vpc.prod_vpc.id

  ingress {
    description = "allow SSH"
    from_port   = 22
    to_port     = 22
    protocol    = "tcp"
    cidr_blocks = ["0.0.0.0/0"]
  }

  egress {
    from_port   = 0
    to_port     = 0
    protocol    = "-1"
    cidr_blocks = ["0.0.0.0/0"]
  }
}

# created bastion host ec2 instance
resource "aws_instance" "bastion_host" {
  ami                    = lookup(var.awsprops, "ami")
  instance_type          = lookup(var.awsprops, "instancetype")
  key_name               = var.keyname
  vpc_security_group_ids = [aws_security_group.bastion-sg.id]
  subnet_id              = aws_subnet.prod_public_subnet.id

  tags = {
    Name = "Bastion_host"
  }

  connection {
    user        = "ec2-user"
    private_key = file("/Users/mac/Desktop/terraform-projects/NV_R_key.pem")
    host        = aws_instance.bastion_host.public_ip

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 10&lt;/strong&gt;&lt;br&gt;
Now we create a security group for our wordpress instance and also create resources for the wordpress instance. &lt;br&gt;
In our security group we will allow port 80 for HTTP traffic from anywhere and for SSH we will allow port 22 from the bastion host security group. On the CIDR block we can input the bastion host's Ip but it will be bad practice because several conditions can cause it to change or we can use an elastic Ip (EIP) which will make it static. But for this tutorial we will add the bastion host's security group.&lt;/p&gt;

&lt;p&gt;The 'user_data' argument can be used to specify data that should be passed to the instance when launched. We will install docker, pull Wordpress image from the docker hub while we launch a wordpress container with this image in the user_data script. Environment variables will be passed while launching wordpress so it automatically configures the MYSQL database.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;resource "aws_security_group" "wordpress-sg" {
  depends_on = [aws_vpc.prod_vpc]

  name        = "Wordpress_SG"
  description = "Security Group for Wordpress EC2 Instance"
  vpc_id      = aws_vpc.prod_vpc.id

  #created an inbound rule for HTTP
  ingress {
    description = "Allow TCP"
    from_port   = 80
    to_port     = 80
    protocol    = "tcp"
    cidr_blocks = ["0.0.0.0/0"]

  }

  #created an inbound rule for PING
  ingress {
    description = "Allow PING"
    from_port   = 0
    to_port     = 0
    protocol    = "tcp"
    cidr_blocks = ["0.0.0.0/0"]

  }

  #created an inbound rule for SSH
  ingress {
    description     = "Allow SSH"
    from_port       = 22
    to_port         = 22
    protocol        = "tcp"
    cidr_blocks     = ["0.0.0.0/0"]
    security_groups = [aws_security_group.bastion-sg.id]

  }

  #created an outbound rule for the wordpress
  egress {
    from_port   = 0
    to_port     = 0
    protocol    = -1
    cidr_blocks = ["0.0.0.0/0"]
  }
  tags = {
    Name = "Wordpress-SG"
  }

}

#created wordpress EC2 Instance
resource "aws_instance" "wordpress" {
  ami                    = lookup(var.awsprops, "ami")
  instance_type          = lookup(var.awsprops, "instancetype")
  vpc_security_group_ids = [aws_security_group.wordpress-sg.id]
  subnet_id              = aws_subnet.prod_public_subnet.id
  key_name               = var.keyname
  user_data              = &amp;lt;&amp;lt;EOF
            #! /bin/bash
            yum update
            yum install docker -y
            systemctl restart docker
            systemctl enable docker
            docker pull wordpress
            docker run --name wordpress -p 80:80 -e WORDPRESS_DB_HOST=${aws_instance.mysql.private_ip} \
            -e WORDPRESS_DB_USER=root -e WORDPRESS_DB_PASSWORD=root -e WORDPRESS_DB_NAME=wordpressdb -d wordpress
  EOF

  tags = {
    Name = "Wordpress_Instance"
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 11&lt;/strong&gt;&lt;br&gt;
Now we will launch an EC2 instance for the MYSQL in the private subnet.&lt;br&gt;
MySQL uses port 3306 as the default port for incoming connections. When defining egress we use protocol '-1' which is a placeholder or wildcard value or the specific protocol can be anything or not relevant/important. We are attaching the wordpress security group to mysql inbound traffic to only allow access it. We also added the bastion host security group which will only allow SSH access to the MSQL Instance.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;resource "aws_security_group" "mysql-sg" {
  depends_on = [
    aws_vpc.prod_vpc,
  ]

  name        = "MYSQL_SG"
  description = "Security Group for MYSQL EC2 Instance"
  vpc_id      = aws_vpc.prod_vpc.id

  ingress {
    description     = "allow TCP"
    from_port       = 3306
    to_port         = 3306
    protocol        = "tcp"
    cidr_blocks     = ["0.0.0.0/0"]
    security_groups = [aws_security_group.wordpress-sg.id]
  }

  ingress {
    description     = "allow SSH"
    from_port       = 22
    to_port         = 22
    protocol        = "tcp"
    cidr_blocks     = ["0.0.0.0/0"]
    security_groups = [aws_security_group.bastion-sg.id]
  }

  egress {
    from_port   = 0
    to_port     = 0
    protocol    = "-1"
    cidr_blocks = ["0.0.0.0/0"]
  }
}

# created a mysql ec2 instance
resource "aws_instance" "mysql" {
  ami                    = lookup(var.awsprops, "ami")
  instance_type          = lookup(var.awsprops, "instancetype")
  key_name               = var.keyname
  vpc_security_group_ids = [aws_security_group.mysql-sg.id]
  subnet_id              = aws_subnet.prod_public_subnet.id
  user_data              = file("mysqlconfig.sh")

  tags = {
    Name = "MSQL-Instance"
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;From above We will pass a script in 'user_data' but this time we save the file locally and call it up with the file command. The file is a bash file hence it will be saved with suffix '.sh' ("mysqlconfig.sh") with configurations below. Make sure to input the latest version of mysql to avoid compatibility issues. The latest version when writing this blog is 8.0.31.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#! /bin/bash
yum update
yum install docker -y
systemctl restart docker
systemctl enable docker
docker pull mysql
docker run --name mysql -e MYSQL_ROOT_PASSWORD=root \
-e MYSQL_DATABASE=wordpressdb -p 3306:3306 -d mysql:8.0.31
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 12&lt;/strong&gt;&lt;br&gt;
We have written code for our infrastructure using terraform, which took some time and was a bit technical. Now we will use some terraform commands to check if our code is valid, create an execution plan and finally apply changes based on the desired state defined in our configuration files.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#validate syntax and overall structure our our terraform configuration
terraform validate
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#generate execution plan and view changes made to our configurations
terraform plan
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.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%2Fl7fh9cegtm61ryuie5op.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fl7fh9cegtm61ryuie5op.png" alt="Image description" width="800" height="404"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#apply changes to infrastructure 
terraform apply
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you are on the right track you should get the prompt below after the infrastructure has deployed on AWS&lt;/p&gt;

&lt;p&gt;[&lt;a href="https://media2.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%2Fyhn29djdl2qbvfc55sez.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fyhn29djdl2qbvfc55sez.png" alt="Image description" width="800" height="389"&gt;&lt;/a&gt; ]&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 13&lt;/strong&gt;&lt;br&gt;
connect to the wordpress EC2 instance via ssh or via EC2 Instance connect from the AWS management console. Once you are connected follow the prompt to configure wordpress. You can also copy the IP address of the wordpress paste on your browser then configure Wordpress. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F0jd9duqcg96dr8m9dxz0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F0jd9duqcg96dr8m9dxz0.png" alt="Image description" width="800" height="770"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 14&lt;/strong&gt;&lt;br&gt;
You can optionally create an outputs.tf file. In Terraform, you can use output variables to display the values of resources created by a configuration.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;output "us-east-1a-Public-IP" {
  value       = aws_instance.wordpress.public_ip
  description = "The Public IP address of the Web Server"
}

output "us-east-1b-Public-IP" {
  value       = aws_instance.bastion_host.public_ip
  description = "The Public IP address of Bastion Host"
}

output "us-east-1a-Private-IP" {
  value       = aws_instance.mysql.private_ip
  description = "The Private IP address of MySQL Database"
}

output "vpc_id" {
  value       = aws_vpc.prod_vpc.id
  description = "The Virtual Private Cloud(VPC) ID "
}

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

&lt;/div&gt;



&lt;p&gt;You can then use the terraform output command to display the values of these output variables after running the terraform apply command.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ terraform output prod_vpc_id
vpc-06578e6056e120939

$ terraform output us-east-1a-Public-IP
54.164.193.1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;FINAL STEP&lt;/strong&gt;&lt;br&gt;
This is the final view once wordpress has been configured, you can upload random images or type some text to your blog.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F8natechbuk3b2wfk51iw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F8natechbuk3b2wfk51iw.png" alt="Image description" width="800" height="983"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We have succeeded in creating a VPC with 1 Public &amp;amp; 1 Private Subnet using Terraform. We also deployed wordpress and mysql using docker while passing user data to the instance. Remember to type 'terraform destroy' to destroy all the infrastructure deployed to avoid incurring unnecessary charges.&lt;/p&gt;

&lt;p&gt;I hope you learnt a lot from this article good luck on your cloud journey :)&lt;/p&gt;

&lt;p&gt;You can get the full code from my GitHub repo below&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/victordgr8t/git-terraform-projects" rel="noopener noreferrer"&gt;&lt;img src="https://media2.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%2Feeylx3qltiq5gffqhasx.png" alt="Image description" width="580" height="230"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>gratitude</category>
    </item>
    <item>
      <title>ROCK PAPER SCISSORS PYTHON GAME</title>
      <dc:creator>Victor Modebe</dc:creator>
      <pubDate>Thu, 15 Dec 2022 11:37:10 +0000</pubDate>
      <link>https://forem.com/victordgr8t/rock-paper-scissors-python-game-88k</link>
      <guid>https://forem.com/victordgr8t/rock-paper-scissors-python-game-88k</guid>
      <description>&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%2Fecodacrsah9s988n7v7w.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%2Fecodacrsah9s988n7v7w.png" alt="Image description" width="800" height="409"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Greetings guys!!! &lt;br&gt;
This tutorial is for people who are new to python and are looking to learn more about it. I would recommend taking the "learn by doing" method, as practical experimentation solidifies your understanding of a topic.&lt;/p&gt;

&lt;p&gt;I will use Visual Studio Code as my IDE, you can use any IDE of your choice. Download a copy of VSCode for your operating system from &lt;a href="https://code.visualstudio.com/download"&gt;https://code.visualstudio.com/download&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To install Python on your computer, you will need to go to the Python website (&lt;a href="https://www.python.org/"&gt;https://www.python.org/&lt;/a&gt;), download the appropriate installer for your operating system, and run the installer.&lt;/p&gt;

&lt;p&gt;Here are the specific steps for Mac, windows, Linux operating systems:&lt;/p&gt;

&lt;p&gt;macOS:&lt;br&gt;
1.Go to the Python website: &lt;a href="https://www.python.org/downloads/macos/"&gt;https://www.python.org/downloads/macos/&lt;/a&gt;&lt;br&gt;
2.Select the appropriate installer for your operating system architecture.&lt;br&gt;
3.When the download is complete, open the downloaded file (called "python-3.11.1.pkg") and follow the prompts to install Python on your computer.&lt;/p&gt;

&lt;p&gt;Windows:&lt;br&gt;
1.Go to the Python website: &lt;a href="https://www.python.org/downloads/windows/"&gt;https://www.python.org/downloads/windows/&lt;/a&gt;&lt;br&gt;
2.Select the appropriate installer for your operating system architecture.&lt;br&gt;
3.When the download is complete, open the downloaded file (called "python-3.11.1.exe") and follow the prompts to install Python on your computer.&lt;/p&gt;

&lt;p&gt;Linux:&lt;br&gt;
1.Open a terminal window.&lt;br&gt;
2.Use the following command to install Python 3 and pip (the package manager for Python). Make sure to use the latest version of python to install pip. When writing this blog the latest version of python is 3:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt-get install python3 python3-pip
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will install the latest version of Python 3 and pip. To verify that the installation was successful, you can run the following commands to check the version of Python and pip that are installed:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;python3 --version
pip3 --version
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These commands should print the version numbers of Python and pip, respectively. If you see version numbers printed, then Python and pip are installed and ready to use.&lt;/p&gt;

&lt;p&gt;Now we are done with the installation of Vscode &amp;amp; Python successfully, the next step is to open Vscode create a folder the create a file with .py extension .py as show 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%2Fcr287835zc40kzkim6cb.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%2Fcr287835zc40kzkim6cb.png" alt="Image description" width="577" height="420"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now we dive in to write our code.&lt;br&gt;
Below is a 4 step explanation of the code required for 'ROCK PAPPER SCISSORS' game written in python:&lt;/p&gt;

&lt;p&gt;STEP 1&lt;br&gt;
To begin with, we will start by importing the random module. We will also define a custom function 'def get_computer_choice' that takes in the player's choice (either "rock", "paper", or "scissors")and returns the computer's choice, randomly selected from the same three options:&lt;br&gt;
&lt;/p&gt;

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

def get_computer_choice(player_choice):
    choices = ["rock", "paper", "scissors"]

    return random.choice(choices)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;STEP 2&lt;br&gt;
In this step we define a custom function 'def get_game_result' that takes in the player's choice and the computer's choice, and returns a string representing the outcome of the game. The possible return values are "player wins", "computer wins", and "tie".&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def get_game_result(player_choice, computer_choice):
    if player_choice == "rock" and computer_choice == "scissors":
        return "player wins"
    elif player_choice == "rock" and computer_choice == "paper":
        return "computer wins"
    elif player_choice == "paper" and computer_choice == "rock":
        return "player wins"
    elif player_choice == "paper" and computer_choice == "scissors":
        return "computer wins"
    elif player_choice == "scissors" and computer_choice == "rock":
        return "computer wins"
    elif player_choice == "scissors" and computer_choice == "paper":
        return "player wins"
    else:
        return "tie"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;STEP 3&lt;br&gt;
In this step we use a while loop which is the main game loop. It continues to run until the player decides to quit by typing 'quit', executed with 'break' an inbuilt- keyword in python .&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;while True:
    player_choice = input(
        "Please enter your choice (rock, paper, scissors, or quit): ")
    if player_choice.lower() == "quit":
        break
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;STEP 4&lt;br&gt;
Finally, we define the outcome of the computers choice and print out the game results.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;computer_choice = get_computer_choice(player_choice)
    result = get_game_result(player_choice, computer_choice)
    print(f"You chose {player_choice}, the computer chose {computer_choice}.")
    print(f"Result: {result}.")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Congratulations!!! You now have written a python code for 'ROCK PAPER SCISSOR' game. You can play against the computer as many times as you want, and see who comes out on top. Quit the game by typing quit.&lt;/p&gt;

&lt;p&gt;If you followed my instructions correctly. This should be how your code will look in VSCode. Also remember, to run your code click the run button on the far right side of the app.&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%2Fifz1mr1ujael389qofo1.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%2Fifz1mr1ujael389qofo1.png" alt="Image description" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The results should appear like 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%2Fh9q4yjdihrslo4q7dzg8.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%2Fh9q4yjdihrslo4q7dzg8.png" alt="Image description" width="800" height="233"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can learn more about python from Mosh Hamedani's on python tutorial from his YouTube channel&lt;br&gt;
&lt;a href="https://www.youtube.com/watch?v=_uQrJ0TkZlc"&gt;https://www.youtube.com/watch?v=_uQrJ0TkZlc&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Good luck in your Python journey!!!&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>programming</category>
      <category>python</category>
      <category>vscode</category>
    </item>
  </channel>
</rss>
