<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Alyson Coppola on Medium]]></title>
        <description><![CDATA[Stories by Alyson Coppola on Medium]]></description>
        <link>https://medium.com/@mydevopsportfolio?source=rss-4c9762d18e7a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*I0RsxbifovnmJA8q5A7OZA@2x.jpeg</url>
            <title>Stories by Alyson Coppola on Medium</title>
            <link>https://medium.com/@mydevopsportfolio?source=rss-4c9762d18e7a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 05:37:57 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mydevopsportfolio/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Terraform, AWS & Cloud9]]></title>
            <link>https://medium.com/@mydevopsportfolio/terraform-aws-cloud9-14001622e6db?source=rss-4c9762d18e7a------2</link>
            <guid isPermaLink="false">https://medium.com/p/14001622e6db</guid>
            <dc:creator><![CDATA[Alyson Coppola]]></dc:creator>
            <pubDate>Mon, 02 Oct 2023 22:42:12 GMT</pubDate>
            <atom:updated>2023-10-05T18:18:52.037Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*Xic6GoVuYcpPOkSmw91m_Q.png" /></figure><p><strong><em>What is Terraform?</em></strong><em> Terraform is an infrastructure as code tool that lets you build, change, and version cloud and on-prem resources safely and efficiently.</em></p><p>You will need an AWS account and a Github account to proceed.</p><h4>To start, you will need to go to AWS and create an environment in cloud 9. Once that instance is up and running, you will then be able to continue.</h4><ul><li>Create the environment, name it, choose New EC2 instance for the Environment type, t2.micro for Instance type, Amazon Linux 2 for the Platform, AWS Systems Manager for the connection and then hit “Create”.</li></ul><p>Next you will need to create a new branch will in cloud 9 to be able to push the code to Github.</p><ul><li>While under main, click “Create new branch” and name it. Then hit enter.</li><li>Then go to Github and you will see your new branch.</li><li>Your terminal in Cloud 9 will also show you are now running under the branch you created.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*rpNCnF9NHf4QjQLcSuyGUg.png" /></figure><h4>Now we need to create your repository.</h4><p>First lets make sure terraform is up to date, run the following command.</p><pre>terraform -v</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/934/1*5aUbRWvB18mf4CAnOmPHxw.png" /></figure><p>Now you need to create your files.</p><ul><li>main.tf</li><li>providers.tf</li><li>variables.tf</li><li>jenkins.sh</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AMW5KcElu_wf_B1QZhUA2w.png" /></figure><p>Next you will want to make sure all show in your terminal. Run the following command.</p><pre>ls</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/850/1*t29PFNG477d48HqZCawePA.png" /></figure><p>Now we will work in the main.tf file. Run the following information.</p><pre>#ec2 instance<br>resource &quot;aws_instance&quot; &quot;jenkins_instance&quot; {<br>  ami           = &quot;ami-0cd06e47208c8afd3&quot;<br>  instance_type = &quot;t2.micro&quot;<br>  user_data     = file(&quot;jenkins.sh&quot;)<br>  tags = {<br>    name = &quot;Jenkins instance&quot;<br>  }<br>  vpc_security_group_ids = [aws_security_group.jenkins_sg.id]<br>}<br><br>#security group<br>resource &quot;aws_security_group&quot; &quot;jenkins_sg&quot; {<br>  name   = &quot;allow_tls and ssh&quot;<br>  vpc_id = var.vpc_id<br><br>  ingress {<br>    description = &quot;TLS from VPC&quot;<br>    from_port   = 8080<br>    to_port     = 8080<br>    protocol    = &quot;tcp&quot;<br>    cidr_blocks = [&quot;0.0.0.0/0&quot;]<br>  }<br><br>  ingress {<br>    description = &quot;SSH into instance&quot;<br>    from_port   = 22<br>    to_port     = 22<br>    protocol    = &quot;tcp&quot;<br>    cidr_blocks = [&quot;0.0.0.0/0&quot;]<br>  }<br><br><br>  egress {<br>    from_port   = 0<br>    to_port     = 0<br>    protocol    = &quot;-1&quot;<br>    cidr_blocks = [&quot;0.0.0.0/0&quot;]<br>  }<br><br>  tags = {<br>    Name = &quot;allow_tls_and_ssh&quot;<br>  }<br>}<br><br>#s3 bucket<br>resource &quot;aws_s3_bucket&quot; &quot;alysoncoppola-bucket-2023&quot; {<br>  bucket = var.bucketname<br>  tags = {<br>    Name = &quot;alysoncoppola-bucket-2023&quot;<br>  }<br>}<br></pre><p>Run the following command to check the formate. If theres any issues it will let you know.</p><pre>terraform fmt</pre><p>Next we will work in the variables.tf file. Run the following information.</p><pre>#define region<br>variable &quot;aws_region&quot; {<br>  type    = string<br>  default = &quot;us-east-1&quot;<br>}<br><br>#define ami<br>variable &quot;ami_id&quot; {<br>  description = &quot;ami id for instance&quot;<br>  type        = string<br>  default     = &quot;ami-0cd06e47208c8afd3&quot;<br>}<br><br>#define instance <br>variable &quot;jenkins_instance&quot; {<br>  description = &quot;instance_type&quot;<br>  type        = string<br>  default     = &quot;t2.micro&quot;<br>}<br><br>#define s3<br>variable &quot;bucketname&quot; {<br>  description = &quot;private jenkins bucket&quot;<br>  type        = string<br>  default     = &quot;alysoncoppola-bucket-2023&quot;<br>}<br><br>#define key pair<br>variable &quot;key_pair&quot; {<br>  description = &quot;key_pair&quot;<br>  type        = string<br>  default     = &quot;us-east-kp&quot;<br>}<br><br>#define VPC <br>variable &quot;vpc_id&quot; {<br>  description = &quot;jenkins_vpc_id&quot;<br>  type        = string<br>  default     = &quot;vpc-0c19b870cf7c29df9&quot;<br>}<br></pre><p>Run the format command again to make sure it is ok</p><pre>terraform fmt</pre><p>Next we will work in the providers.tf file. Run the following information.</p><pre><br># define region<br>terraform {<br>  required_providers {<br>    aws = {<br>      source  = &quot;hashicorp/aws&quot;<br>      version = &quot;~&gt; 5.0&quot;<br>    }<br>  }<br>}<br><br># AWS Provider<br>provider &quot;aws&quot; {<br>  region = &quot;us-east-1&quot;<br>}<br><br># Create VPC<br>resource &quot;aws_vpc&quot; &quot;example&quot; {<br>  cidr_block = &quot;172.31.0.0/16&quot;<br>}<br></pre><p>Run the format command again to make sure it is ok.</p><pre>terraform fmt</pre><p>Next we will work in the jenkins.sh file. Run the following information.</p><pre>#!/bin/bash<br>sudo yum update –y<br>sudo wget -O /etc/yum.repos.d/jenkins.repo \<br>    https://pkg.jenkins.io/redhat-stable/jenkins.repo<br>sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io-2023.key<br>sudo yum upgrade<br>sudo amazon-linux-extras install java-openjdk11 -y<br>sudo dnf install java-11-amazon-corretto -y<br>sudo yum install jenkins -y<br>sudo systemctl enable jenkins<br>sudo systemctl start jenkins<br>sudo systemctl status jenkins<br><br></pre><p>Run the format command again to make sure it is ok.</p><pre>terraform fmt</pre><p>Next you need to initialize it. Run the following command.</p><pre>terraform init</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wKhkRTIrDDjRfzSkNC10Vw.png" /></figure><p>Now you need to validate it. Run the following command.</p><pre>terraform validate</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*afvEKrebn_5pnniFYZNr7Q.png" /></figure><p>Next run the following command. When it ask you to enter a value type the word yes.</p><pre>terraform plan</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1012/1*P25ziHyEVP67SQeSYv5x6A.png" /></figure><p>Now you need to run the following command and type yes when it asks you for value.</p><pre>terraform apply</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uiVL317arppnmLboeIefjA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/864/1*XUhauG-Rj2K1B1bL1NFQMg.png" /></figure><p>Now you will need to go back to AWS and get the IP address. Copy and paste it into the search engine. Before you hit enter make sure you add “:8080” at the end. You will see the image below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uEkOp9davj0kBBGIgkXmwA.png" /></figure><p>Next you will need to clean up your environment. Run the following command. Type yes when it asks you for value.</p><pre>terraform destroy</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/994/1*aJcOWrJFys6HJTLZKxYcbw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/850/1*59mUufgp9NAXRGV0AzS33A.png" /></figure><p>Congratulation!!! You have finally finished. Great job!</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*LbK6u9H1QEG63jtt_1oUdw.png" /></figure><p><a href="https://github.com/nylover85/terraform.git">GitHub - nylover85/terraform: week20-terraform</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=14001622e6db" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Creating a Wordpress using Docker swarm.]]></title>
            <link>https://medium.com/@mydevopsportfolio/creating-a-wordpress-using-docker-swarm-85dba731a5e0?source=rss-4c9762d18e7a------2</link>
            <guid isPermaLink="false">https://medium.com/p/85dba731a5e0</guid>
            <dc:creator><![CDATA[Alyson Coppola]]></dc:creator>
            <pubDate>Tue, 19 Sep 2023 19:15:12 GMT</pubDate>
            <atom:updated>2023-09-19T19:15:12.495Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BCuETjYA9OL7_x16HfiZ4g.png" /></figure><p><strong><em>What is WordPress? </em></strong><em>WordPress is a popular and widely used content management system (CMS) and website creation tool. It is a free and open-source software that allows users to easily build and manage websites, blogs, and online stores without requiring extensive technical knowledge.</em></p><p><strong><em>What is a backend network? </em></strong><em>Backend networks are used to interconnect large systems such as mainframes, supercomputers, and mass storage devices. The key requirement for backend network is bulk data transfer with high reliability among a limited number of devices in a small area.</em></p><p><strong><em>What is a frontend network? </em></strong><em>Any hardware that optimizes or protects network traffic. It is called application front-end hardware because it is placed on the network’s outward-facing frontend or boundary. Network traffic passes through the front-end hardware before entering the network.</em></p><ul><li><strong>You will need an AWS account, VS code, and Docker installed.</strong></li></ul><h4>To start you will need to deploy a 3 node Docker Swarm cluster in AWS. You can refer to my previous article if you need assistance with those steps here:</h4><p><a href="https://medium.com/@nylover85/step-by-step-guide-on-how-to-set-up-docker-swarm-using-vscode-48b7c2f9d440">Step by step guide on how to set up Docker Swarm using VSCode.</a></p><h4>For this next part, we will create 2 networks</h4><p>While in VS code run the following command. This will create the frontend network.</p><pre>sudo docker network create --driver overlay frontend</pre><p>Next you will need to run the following command to create the backend network.</p><pre>sudo docker network create --driver overlay backend</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zcuJbE-A1gX_HVMbG5bsFA.png" /></figure><p>Now run the following command to see the frontend and backend listed under the manager node</p><pre>sudo docker network ls</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/996/1*e8wW-km1AbNMSt5at4kl5Q.png" /></figure><h4>Next we need to create MySQL service</h4><p>First you will need to run the following command. You will be associating this with the backend and entering 1 replica. This will use Docker Volumes.</p><pre>sudo docker service create --name mysql --network backend --replicas 1 --detach=false --mount type=volume,source=mysql-data,destination=/var/lib/mysql -e MYSQL_ROOT_PASSWORD=redteam23 mysql:latest</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NLz2taCURkdBa5Q3vh0QFg.png" /></figure><p>Now you want to run the command below to to check the progress.</p><pre>sudo docker service ps &lt;number&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h7uG6c0BmgM_8lGSj713Rw.png" /></figure><h4>Now we need to create the Wordpress service</h4><p>First you will need to run the following command. You will be associating this command with the frontend, have 3 replicas and use port 80.</p><pre>sudo docker service create --network frontend --name wordpress --replicas 3 -p 80:80 --mount type=volume,source=wordpress-data,target=/var/www/html wordpress:latest</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kV0kACmbRxRAx3b7MJLm8w.png" /></figure><h4>Lets check the browser</h4><p>Now you need to go to AWS, instance and copy the public IP address from the manager node instance. Paste this in google search and before you hit enter add “:80” to the end of it. Then hit enter. You should see on your screen the image below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1010/1*uaZZL39jDpX6HEnacCSj_Q.png" /></figure><p>Now lets leave the swarm. Run the following command in the manager node first, then the 2 worker nodes.</p><pre>sudo docker swarm leave --force</pre><p>Then run the following command to make sure you have left. Do this in the manager node first, then the other 2 worker nodes.</p><pre>sudo docker service ls</pre><p>Lastly, run this command to exit.</p><pre>exit</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kmlY6JJKMLBdWxbBW6iykA.png" /></figure><p>Don’t forget to go to AWS, instances and stop the 3 instances you have running.</p><h3>You are now done!</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/452/1*OmuP5Ho4itv-w2L8hTqnEQ.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=85dba731a5e0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Step by step guide on how to set up Docker Swarm using VSCode.]]></title>
            <link>https://medium.com/@mydevopsportfolio/step-by-step-guide-on-how-to-set-up-docker-swarm-using-vscode-48b7c2f9d440?source=rss-4c9762d18e7a------2</link>
            <guid isPermaLink="false">https://medium.com/p/48b7c2f9d440</guid>
            <dc:creator><![CDATA[Alyson Coppola]]></dc:creator>
            <pubDate>Sun, 10 Sep 2023 18:56:56 GMT</pubDate>
            <atom:updated>2023-09-10T18:56:56.147Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/428/1*Q5gwdnZ_NFqwbG4HWR0LNQ.png" /></figure><p><strong><em>What is a Docker Swarm? </em></strong><em>Docker Swarm is a clustering and scheduling tool for Docker containers. With Swarm, IT administrators and developers can establish and manage a cluster of Docker nodes as a single virtual system. Swarm mode also exists natively for Docker Engine, the layer between the OS and container images.</em></p><p><strong><em>What is a Docker Swarm Node? </em></strong><em>Nodes in a Docker Swarm communicate with each other to maintain the cluster&#39;s state and ensure that containers are deployed and managed according to the desired configurations. This allows you to scale your applications horizontally by adding more worker nodes and ensures that your services remain available even if some nodes fail.</em></p><p><strong><em>Manager Node:</em></strong><em> Manager nodes are responsible for managing the overall swarm cluster. They control the orchestration and scheduling of services and tasks. Manager nodes store the cluster’s state and configuration and can perform tasks such as service creation and scaling.</em></p><p><strong><em>Worker Node:</em></strong><em> Worker nodes are responsible for running the containers that make up your applications. They receive and execute tasks (containers) assigned by the manager nodes. Worker nodes do not participate in the management of the swarm cluster but focus on running containers efficiently.</em></p><h3>To start we need to launch an instance.</h3><p>Go to AWS, EC2 and launch an instance. Name the instance, choose Ubuntu for the AMI and t2.micro.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/799/1*4J0j101OryaEEPVcPHzwhA.png" /></figure><p>Now you need to create a key pair or choose one you already have.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/752/1*yLlcZ9JVedXEuZ4b5BdM8g.png" /></figure><p>Next you need to create a security group or choose one you already have.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/751/1*j4IhVUMtQO2J2Jncrri8Yw.png" /></figure><p>Next you will go to advanced details and click the drop arrow, then scroll down to User data and enter the following to install docker.</p><pre>curl -fsSL https://get.docker.com -o get-docker.sh<br>sh get-docker.sh</pre><p>Now you will go to the right side of the screen where it says Summary. You will change the Number of instances to 3. Then click on “Launch instance”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/714/1*cddBJRYdPJX4dSIk2-02yA.png" /></figure><p>You will see a green banner at the top of your screen that says success.</p><p>Now we need to change the names of the 3 instances we just launched. Go back to instances and you will see 3 running that all have the same name.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ruXKaooTGY3ZV96aCDKnDg.png" /></figure><p>Click on the name to edit it to what you want, then click save. Do this for all three.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/852/1*AbWsQDAVTexqHZ_lisFHvQ.png" /></figure><p>Lets confirm that we can ssh into the terminal on our computer to make sure we don’t have any issues. Go to the NODE1 instance (this will be the “manger node”) go to the ssh client, copy the chmod command and paste in the terminal on your computer and hit enter. Then go back to the instance and copy the ssh and paste that into your terminal and hit enter. Type “yes” when it asks. You should then see Ubuntu on the terminal. This confirms that so far everything is set up correct.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*stSms--uus2MHDPdfjhGbA.png" /></figure><h3>Now we need to verify that Docker is active.</h3><p>First you will need to go to Visual Studio code, open the terminal and ssh. You will need copy the set of information on the top of the config screen and paste it in the section below it. Do that one more time to show a total of 3. Then you will need to update all three sections to match your information from the AWS instance for each node.</p><ul><li>Update the Host.</li><li>Update the HostName with the IP address. I used the public IP address.</li><li>Update the IdentityFile with the correct key pair.</li></ul><p>Once all 3 nodes are reflective of the information in AWS instances, save the information. Hit command S.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/665/1*4ahy_8FZPPT7arstMU7baQ.png" /></figure><p>Now we need to work in the terminal of VS code and ssh in. But first, lets split the terminal into 3 sections because we have 3 nodes. You will then see 3 sections that all say the home of your terminal.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/90/1*AMxmN22OApUF1y-XvxS-ig.png" /></figure><h3>Now we need to ssh into each node.</h3><p>For the first box of the terminal, we are working with the “manager node”. This is the first node you created (My first node is NODE1). You will run the following command.</p><pre>ssh &lt;name&gt;</pre><p>Now you will go to the second terminal and we will ssh into the second node you created (My second node is NODE2). You will run the following command.</p><pre>ssh &lt;name&gt;</pre><p>It will then ask you if you want to continue, type “yes” then hit enter.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/518/1*Ym-wyIWsKFLzgplicvX8MA.png" /></figure><p>Now you will go to the third terminal and we will ssh into the third node you created (My third node is NODE3). You will run the following command.</p><pre>ssh &lt;name&gt;</pre><p>It will then ask you if you want to continue, type “yes” then hit enter.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/518/1*Ym-wyIWsKFLzgplicvX8MA.png" /></figure><p>After you ssh into all three nodes your terminal should look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4O9a0eC4d51V1RBuBirZ1A.png" /></figure><p>You can run the following command to change the host name in the terminal to reflect the node names. You will want to do this for the second and third node.</p><pre>sudo hostnamectl set-hostname &lt;name&gt;</pre><p>After you run that command, you will want to run this command next.</p><pre>exit</pre><p>Once you hit enter after you run the previous command, you will need to ssh back in to then reflect the node name. You will need to do this for each node.</p><pre>ssh &lt;name&gt;</pre><p>Your terminal will then look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QKGhZkak-HVYsBsa6pNjFQ.png" /></figure><p>Now lets check for updates. Run the following command for each node.</p><pre>sudo apt update</pre><h3>Next we will create the Swarm.</h3><p>In the first terminal (NODE1) run the following command.</p><pre>sudo docker swarm init</pre><p>You will then see the following response:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/870/1*hZhk-xPlEXaRu8ZCkpilOQ.png" /></figure><p>Now you will need to copy the docker swarm join token and paste that into the second terminal (NODE2) and run the following command.</p><pre>sudo docker swarm join --token &lt;paste token here&gt;</pre><p>Repeat this for the third terminal (NODE3). Your screen should look like this after.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/644/1*JSK917p8ChB2buHAkgldLg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/506/1*CB9QP8CCnQWqt_et_VzPSA.png" /></figure><h3>View status of Docker Nodes</h3><p>Go to the first terminal (NODE1) and run the following command.</p><pre>sudo docker node ls</pre><p>This shows you all three nodes, there status and that NODE1 is the manager.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UK9RmqmutPHpFHEJQHrfow.png" /></figure><p>Now run the following command under the first terminal (NODE1) to leave your swarm.</p><pre>sudo docker swarm leave --force</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/742/1*zZvp2_YB0x-J9vyAByI1Ng.png" /></figure><p>Repeat that for the other nodes.</p><p>Next run the following command to confirm you have left the swarm</p><pre>sudo docker service ls</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/778/1*Ilwk8Y4Hu4vrXsqQPIadnw.png" /></figure><p>Repeat that for the other nodes.</p><p>Now we need to exit the ubuntu in the terminal, run the following command. It will take you back to your name in your terminal.</p><pre>exit</pre><p>Repeat this for the other two terminals.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*o6iEH9ziEQCyORmvSQVlMQ.png" /></figure><p>Lastly, go back to AWS, instance and stop the three node instances that are running.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*govkTIlPqfAFGR9ArQ_aYA.png" /></figure><p>You are now done. Great Job!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/261/1*2L-_a9NDqcculB1Lt0NTeQ.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=48b7c2f9d440" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using Docker to launch a Jenkins container]]></title>
            <link>https://medium.com/@mydevopsportfolio/using-docker-to-launch-a-jenkins-container-dda59139b45b?source=rss-4c9762d18e7a------2</link>
            <guid isPermaLink="false">https://medium.com/p/dda59139b45b</guid>
            <dc:creator><![CDATA[Alyson Coppola]]></dc:creator>
            <pubDate>Mon, 04 Sep 2023 01:36:28 GMT</pubDate>
            <atom:updated>2023-09-04T01:36:28.452Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/355/1*CLDWlKU6TH8cdNtIISr3Sg.png" /></figure><h4>In this article, I will show you how to use Docker for creating and managing Jenkins containers with persistent volumes.</h4><p>~You will need an AWS account, Docker account, Jenkins account as well as Jenkins installed on the terminal.</p><p><strong><em>What is Jenkins? Jenkins is an open-source automation server written in java that automates parts of the software development process. It is used to build, test and deploy software continuously which makes it easier for developers to integrate changes to the project and makes it easier for users to obtain a fresh build. Jenkins provides hundreds of plugins to support building, deploying and automating any project.</em></strong></p><h3>To begin:</h3><ul><li>First you will need to go to AWS and launch an instance. Choose Ubuntu as your AMI. Make sure you select or create a key pair as well as a security group.</li><li>Next you will go to your Visual Studio Code, and ssh your EC2 instance. Then switch to Docker in the terminal.</li></ul><h3>Now lets get started!!!</h3><ul><li>Go to the Docker Hub and copy the Jenkins LTS Image. Then paste it in the VS terminal to run it. I had to use sudo due to permissions.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/442/1*495s27pQK1lxP70PZb-rVA.png" /></figure><pre>sudo docker pull jenkins/jenkins:lts</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Qp8UMeRZTnHJ5HGU5OYfow.png" /></figure><p>Now we need to see what port our image uses, run the following command.</p><pre>sudo docker inspect jenkins/jenkins:lts</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*clY-rMLV9x69-kHWfi2VRw.png" /></figure><p>Scroll down and find the “ExposedPorts”. You can see we have 2 ports 5000 and 8080, these will be the two ports we list when we run our container.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/478/1*0bbJSf3mmCl11xHVvZw5KA.png" /></figure><p>For this next command, we will run and create our own volume that will hold our containers data. Run the following command.</p><pre>sudo docker container run -d -it -p 8080:8080 -p 50000:50000 -v jenkins:/var/jenkins_home jenkins/jenkins:lts</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LUjL7kbQglYrcGl2u16RBA.png" /></figure><p>Next run the following command to see the volume name.</p><pre>sudo docker volume ls</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*iFwGYRNAac0OWcsY4a3H4w.png" /></figure><p>Now we need to run the following command to check our container.</p><pre>sudo docker container ls</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*X1Xg4y-u-tZv8IHAHHHX6A.png" /></figure><p>Next we need to check it in our browser. You will need to go back to AWS, instance and copy the public IPv4 address. Then go to the search engine and paste it. Before you hit enter add “:8080” to the end of it, then hit enter. You should see the image pictured below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3hhxCW7N4MqcbWBQ4JFjZg.png" /></figure><p>Now for this next step, we will need to get the administrator password. We will use the command that is in the above picture in red writing and paste it the terminal. Make sure you put your container ID number in here. If you are unsure of the container ID number, it is in the line above where you ran the “sudo docker container ls command”.</p><pre>sudo docker exec &lt;CONTAINERID&gt; cat /var/jenkins_home/secrets/initialAdminPassword</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lzvpUCte5geXx-83fLWOGg.png" /></figure><p>This will then generate the password needed. Copy that and go back to the browser. Paste it in the password box and hit enter.</p><p>Under Customize Jenkins, you will want to select the “Install suggested plugins”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/821/1*DUlM3rpTZNKP03FsE5fkoQ.png" /></figure><p>In this next section you will Create First Admin User and you will use your personal information. Then hit “Save and Continue”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/969/1*bik2DgMlr62kQHkykTr6GQ.png" /></figure><p>For this next section, select the “Not now” option on the bottom right corner of the screen.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/711/1*S1y7j58yaK64em74ZYxrzw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/265/1*3KKs2bX2_IaVqG9Ht6wryw.png" /></figure><p>Now our Jenkins is ready! Click on the “Start using Jenkins” to go into the Jenkins account.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/925/1*oKvuPjGRYJ6KAotbuiBEeg.png" /></figure><p>Now you are on the homepage. Go to the left side of the screen and select “Manage Jenkins”. Then go to the right side of the screen and select “Users”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/370/1*en3ScJ2ie_maatdQDPuHvA.png" /></figure><p>This will then show your user ID and name.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KWGYQSHZAjIJX94Q4yCeYA.png" /></figure><h4>For this next part, we will want to create another container to make sure the user we created in Jenkins, is available in another container.</h4><p>First we need to stop the container we originally created by running the following command. Make sure you enter your container ID in this command.</p><pre>sudo docker container stop &lt;CONTAINERID&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nFQY3gljnLcAhewiwb4gTw.png" /></figure><p>Next we will run the following command and enter the name of our container.</p><pre>sudo docker container run -d -it -p 8080:8080 -p 50000:50000 --name &lt;INSERTANAME&gt; -v jenkins:/var/jenkins_home jenkins/jenkins</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fQsecf4I8jBrNTzt8Rfw_A.png" /></figure><p>To confirm our volumes are correct, run the following command.</p><pre>sudo docker volume ls</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OIqZhBOhczybvZW2r4BpDg.png" /></figure><p>Now to confirm our new container is running, run the following command.</p><pre>sudo docker container ls</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2cpeMxPIXJLaAENZQ-zjPg.png" /></figure><h4>Now we need to confirm the user is working that we created earlier</h4><p>Go back to AWS, instance and copy the public IPv4 address. Paste it in the browser. Before you hit enter add “:8080” to the end of it, then hit enter. You should see the Jenkins login page on your screen.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yPmIykzklIViZPUz59BIWA.png" /></figure><p>Now sign into Jenkins using the Username and Password you created earlier. You should then see your information displayed on the screen.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C3OBmU1Vcwyyyz1iscaRPg.png" /></figure><p>Now we need to run the following commands to clean up the terminal.</p><pre>sudo docker container stop &lt;container name&gt;<br>sudo docker container rm &lt;container name&gt;<br>sudo docker image rm &lt;image name&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uHyvhb8LucBwOAZ_pzE3eg.png" /></figure><p>Congratulation!!! You have successfully pulled a Jenkins image from the Docker Hub, created a Docker volume, ran the container with the correct volume and port, created a Jenkins account and launched a new Jenkins container using the same volume once logging in as the newly created user.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/482/1*XMnfSCXxjWi5H1gOt7jZJQ.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dda59139b45b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using AWS and Docker to push an image]]></title>
            <link>https://medium.com/@mydevopsportfolio/using-aws-and-docker-to-push-an-image-a61b8f792de8?source=rss-4c9762d18e7a------2</link>
            <guid isPermaLink="false">https://medium.com/p/a61b8f792de8</guid>
            <dc:creator><![CDATA[Alyson Coppola]]></dc:creator>
            <pubDate>Wed, 30 Aug 2023 19:43:01 GMT</pubDate>
            <atom:updated>2023-08-30T19:43:01.223Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/452/1*Ck73zqEQeoK16lAlWpSgMg.png" /></figure><p><strong><em>Docker is a platform designed to help developers build, share, and run container applications. Docker works with all development tools such as VS Code, CircleCI, and GitHub.</em></strong></p><h4>You will need an AWS account, a Visual Studio Code and a Docker Hub account to proceed.</h4><h3>To start, you will need to launch and EC2 instance. Go to AWS, EC2, Launch an instance.</h3><ul><li>Name your instance</li><li>Choose Ubuntu for the AMI</li><li>Choose Ubuntu Server 22.04 LTS (Free tier eligible)</li><li>Choose t2.micro for the Instance type</li><li>Create a new key pair</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/767/1*4XsZx1QCJh1vPusDOixS7A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*x9DFthnSE19ZtQabv7ULvw.png" /></figure><p>Next, under Network settings, you will want to click edit and select the following:</p><ul><li>Choose default VPC</li><li>Leave Subnet as No preference</li><li>Enable Auto-assign public IP</li></ul><p>Now we need to Create a Security group.</p><ul><li>Name the Security group</li><li>Give it a description</li><li>Type is ssh</li><li>Source type is My IP</li></ul><p>Now click “Launch instance”</p><ul><li>You will see a green success banner at the top of your screen.</li></ul><h3>Now we need to go to the Visual Studio Code and ssh in</h3><p><strong>First you need to update the public IP address from out EC2 instance in the VS terminal.</strong></p><ul><li>Open up the Visual Studio terminal</li><li>Click the blue icon on the bottom left corner of the screen. Go to the search bar and click connect to host. Go to configure ssh. Choose your config file.</li><li>Go to EC2, instance and copy the public DNS and paste it in the HostName line. Then save it.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2eTyNzeeOF115FHMFW0hLQ.png" /></figure><p>Now go back to the bottom left corner and click the blue icon. Then click connect to host, then select Docker. Then select yes when it asks if you want to continue. The bottom left corner of your screen will say SSH: Docker.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/336/1*eoosFUsGjk421xI0F_s2SA.png" /></figure><ul><li>Next you will click the double zero icon at the bottom left of the screen, this will take you to the terminal and you should be running in ubuntu.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/120/1*f2HFB-EmwW6Vf7OSMsFoAg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-VrKElOA3HH5NZUPgQK5ig.png" /></figure><ul><li>You will run the following command to install Docker</li></ul><pre>curl -fsSL https://get.docker.com -o get-docker.sh</pre><ul><li>Then you need to run</li></ul><pre>sh get-docker.sh</pre><ul><li>You can run this command to confirm you have docker installed.</li></ul><pre>sudo docker version</pre><ul><li>Now to begin, you will need to pull the image and start the container. Run this command</li></ul><pre>sudo docker container run -d --publish 80:80 --name webserver -it ubuntu</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HLmS-uPWGSjQUhLsc2nAvA.png" /></figure><ul><li>Now we need to run the following command. This will change you from ubuntu to root.</li></ul><pre>sudo docker container exec -it webserver bash</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bWBZibcDP6mlXJuRl0cyjQ.png" /></figure><ul><li>Now run the following command to update</li></ul><pre>apt update</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*L36s5IMCtb6UYb6EWgPx-Q.png" /></figure><ul><li>Now we need to install Apache. Run the following command. When is asks you yes or no to continue, type “Y”.</li></ul><pre>apt install apache2</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/848/1*b6-nsF_INweLHGT-ZcT7zA.png" /></figure><ul><li>Next we need st start Apache, run the following command</li></ul><pre>service apache2 start</pre><p><strong>Now you will need to go back to EC2, instance and copy the public IP address and paste it into a search engine to see if it works. You will see a “It works!’ on the screen once you hit enter.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*L85tpkw2paYElKrnB7LOIA.png" /></figure><ul><li>In this next section, we will write out our message. But first we need to install nano. Run the following command</li></ul><pre>apt install nano</pre><ul><li>To start run this command.</li></ul><pre>cd /var/www/html</pre><ul><li>Then run this to remove the index file</li></ul><pre>rm index.html</pre><ul><li>Then run the following command to open the nano and type your message</li></ul><pre>nano index.html</pre><ul><li>Now you can type your message in the nano screen</li></ul><pre>&lt;html&gt;<br>&lt;body&gt;<br>&lt;h1&gt;&lt;center&gt;Docker Project&lt;/h1&gt;<br>&lt;body&gt;<br>&lt;html&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_M6Joy9auyhslmG2iVDatA.png" /></figure><ul><li>When you have finished writing your message, save it. Press Ctrl + O, enter, and then Ctrl + X to exit the screen. This will bring you back to the VS terminal.</li></ul><h3>Lets check the browser and confirmed it worked</h3><p>Go back to EC2, instance and copy the Public IPv4 DNS. Then go to google search and paste it. Then hit enter. If it worked, you should see the message that you typed in the nano box appear on the google search.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eOp8suA6czhf9cfHqQzGug.png" /></figure><ul><li>Now we need to exit the container, run the following command</li></ul><pre>exit</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/788/1*7D6hrceNyD2X2RNTjm4LyA.png" /></figure><ul><li>Next we need to run the following command to create the image</li></ul><pre>sudo docker commit webserver</pre><ul><li>Now run the following to see the list of images, the one you want it the one with out a tag or repository.</li></ul><pre>sudo docker image ls</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Pe-DTbjAL9e3mxMlKHkARg.png" /></figure><ul><li>Now we need to add a tag to the docker image, run the following command. You will need the image id, your docker login name and then the name you give the image.</li></ul><pre>sudo docker tag &lt;image ID&gt; &lt;repository name&gt;</pre><ul><li>Next run the following command to see the image listed</li></ul><pre>sudo docker image ls</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*P83jSQhJjl1gsCOCNYT4pQ.png" /></figure><ul><li>Now we need to push our image. You will need to log into your docker account in the terminal. Run the following command. It will ask you for your login and password. Then hit enter.</li></ul><pre>sudo docker login</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B3dJxus1GUvDPLOMXgnqgw.png" /></figure><ul><li>Now you need to push your image to the docker hub, run the following command</li></ul><pre>sudo docker push &lt;repository_name&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NMKtkgHaxzrGVY6q9CBaqQ.png" /></figure><ul><li>Next we need to go to Docker hub and confirm that the image was pushed to the repository successfully.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AL-t3c8rWrp8NtD4DLQtNQ.png" /></figure><p>Next you want to logout of docker, run the following command</p><pre>sudo docker logout </pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/221/1*AudmpAXegW3oK2G96KVn_Q.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a61b8f792de8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to use AWS along with SQS, Lambda, and Python for tracking services.]]></title>
            <link>https://medium.com/@mydevopsportfolio/how-to-use-aws-along-with-sqs-lambda-and-python-for-tracking-services-286e049c7b11?source=rss-4c9762d18e7a------2</link>
            <guid isPermaLink="false">https://medium.com/p/286e049c7b11</guid>
            <dc:creator><![CDATA[Alyson Coppola]]></dc:creator>
            <pubDate>Mon, 21 Aug 2023 15:50:27 GMT</pubDate>
            <atom:updated>2023-08-21T15:50:27.957Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/629/1*dwOzZU4SwW90Ql9q2htzNw.png" /></figure><p>In order to proceed, you will need an AWS account and Boto3 installed.</p><h3><strong>To start we need to create a Lambda function. Log into your AWS account account. Go to Lambda and create a function.</strong></h3><ul><li>Choose Author from scratch</li><li>Name the function</li><li>Choose the run time</li><li>Choose your Architecture</li><li>Choose your permissions (click the drop down triangle)</li><li>Click “Create function”</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hL-vjLMmLyyNnHN7dTCq-w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N8Cy0Gg7cTDSabt22B5iiQ.png" /></figure><p><strong>You will see a green banner at the top of your screen that says success.</strong></p><p>Next you will see your function overview. Scroll down to “Configuration”. Then on the left side of the screen click “Permissions”. Then click on your role name.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YUjx81rnr5WtGfNmTCzrtQ.png" /></figure><ul><li>Click on Add permissions</li><li>Click on Attach policies</li><li>Type sqs in the search field then hit enter</li><li>Select AmazonSQSFullAccess</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AJxwF9eEo2leXirgoapXzQ.png" /></figure><ul><li>Click “Add permissions”</li><li>You will see a green banner at the top of your screen that says success.</li></ul><h3>Next step is we need to create an SQS Queue With Python.</h3><p>Go back to Lambda, functions and scroll down to “Code”. Replace the default Python code with the following:</p><pre>import json<br>import boto3<br><br>def lambda_handler(event, context):<br>    client = boto3.client(&#39;sqs&#39;)<br>    response = client.create_queue(<br>        QueueName=&#39;queue_created_by_lambda&#39;<br>    )<br><br>    return {<br>        &#39;statusCode&#39;: 200,<br>        &#39;body&#39;: json.dumps(&quot;Created a queue!&quot;)<br>    }</pre><ul><li>Click “Deploy”</li><li>Click “Test”</li></ul><p>You will see a response that looks like the following:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FJd8QKv-4s66-WpTiaZntA.png" /></figure><p>Now go to SQS and look for the queue you just created.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*40Mx2TNJkgewgKr6Hp-yxQ.png" /></figure><h3>Next we need to send a Message to the SQS Queue.</h3><p>In order to send messages to the queue, we will now edit the Python code. Go back to Lambda, functions and select your function. Scroll down to “Code”. Enter the following code:</p><p><em>-To get your QueueUrl, you will need to go to SQS, Queues, and then click on the queue you created previously. You will then be on the Details page. Cope the URL from there and paste it in the code bellow. Make sure to add the ‘’ markings at the beginning and the end of the URL before you deploy it.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZF4Vkj8wLVNzGcfSOuXaUA.png" /></figure><pre>import json<br>import boto3<br>from datetime import datetime<br><br>currentDateAndTime = datetime.now()<br>my_message = &quot;The current date and time is: &quot; + str(currentDateAndTime)<br><br>def lambda_handler(event, context):<br>    client = boto3.client(&#39;sqs&#39;)<br>    <br>    response = client.send_message(<br>        QueueUrl=&#39;https://sqs.us-east-1.amazonaws.com/159288999110/queue_created_by_lambda&#39;,<br>        MessageBody=my_message<br>    )<br><br>    return {<br>        &#39;statusCode&#39;: 200,<br>        &#39;body&#39;: json.dumps(&quot;Message sent to sqs queue&quot;)<br>    }Click “Test”</pre><p>You will see a response that looks like the following:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5Wlz4SBgV4KWON9o9aLWrQ.png" /></figure><p>Next you need to go back to SQS, Queues and then click “Send and receive message”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PIBhgoAbHCah6whfBofKcA.png" /></figure><p>Then click on “Poll for messages” You will see the Polling progress increase its percentage till its all done and then you will see a green check mark.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PQYzSyl9OtRHscmfuecZ5Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TBgmLCK1FWZxJpBmyp9-sg.png" /></figure><h3>Next we need to set up an HTTP API Trigger</h3><ul><li>Go to AWS API Gateway</li><li>Go to Choose an API type and select “HTTP API”, the click “Build”</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6w7PRUTDb8rWAKCCfflC3A.png" /></figure><p>Now under Create and configure integrations, click “Add integration”</p><ul><li>Click the drop down triangle and select Lambda. The AWS Region will be auto filled as well as the Version. You need to select your Lambda function that you previously created. You also need to name the API. Then click “Create”.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vq5JRlLGpFxKQx5aMTrkAA.png" /></figure><h4>Next we need to update the Resource path.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7DxRepJqLPNuv77z4tf0ww.png" /></figure><ul><li>You will only make changes to the Resource path box. Delete everything after the /, then click “Next”.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DjZZVctU6pamlNOsaU5b1w.png" /></figure><ul><li>No changes made on the next page which is Define stages, just click “Next”.</li><li>No changes made on the Review and create page, scroll down and click “Create”.</li><li>You will see a green banner that says success on the top of your screen.</li></ul><p><strong>Now we need to click on the Invoke URL to test it.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QjaMN26RtAGcMrwkDGcLMg.png" /></figure><p>You will then see the message. It worked!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/606/1*G_-vvZzFECzg93mRR8dBBw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/335/1*uOE-KEFtkDTD5ZWTKFATeA.png" /></figure><p>Go back to SQS, hit refresh, click on the Queue, click on Send and receive messages, scroll down and click on “Poll for messages”. You should see that now under messages available it went from 1 to 2. The Polling progress percentage will increase until it gets to 100% then you should see a green check mark. You will then see 2 ID’s at the bottom of that section.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*q8xQG_nD3P68ey0TZ2a8Og.png" /></figure><h3>That’s it, you are now done!</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/337/1*jQB0fbvtTHDbq0dm1Aos5w.png" /></figure><p><a href="https://github.com/nylover85/week15project/blob/aae6ff08f38d7c6c077b06417cd459696881ecb3/README.md">week15project/README.md at aae6ff08f38d7c6c077b06417cd459696881ecb3 · nylover85/week15project</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=286e049c7b11" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using a Python script to run and stop EC2 instances.]]></title>
            <link>https://medium.com/@mydevopsportfolio/using-a-python-script-to-run-and-stop-ec2-instances-5651da4c1a66?source=rss-4c9762d18e7a------2</link>
            <guid isPermaLink="false">https://medium.com/p/5651da4c1a66</guid>
            <dc:creator><![CDATA[Alyson Coppola]]></dc:creator>
            <pubDate>Mon, 14 Aug 2023 17:47:41 GMT</pubDate>
            <atom:updated>2023-08-14T17:47:41.345Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GmjfzArwOZZkWNdxfLAHQQ.png" /></figure><p>In this article, we will learn how to save money by creating a Python script that will stop EC2 instances when they are not needed during “off hours”. You will need an AWS account with an IAM user account. Make sure you have Boto3 installed and your AWS credentials configured correctly. You will also need an IDE that is connected to your Github account.</p><p><strong><em>What is Boto3? </em></strong>Boto3 is a Python library developed by Amazon Web Services (AWS) that provides an interface for interacting with various AWS services and resources. It allows developers to programmatically create, configure, and manage AWS services, such as computing instances, storage, databases, and more, using Python code.</p><h4>Install AWS CLI and Boto3</h4><p>First, If you haven’t used AWS or Boto3 in your CLI before, you will need to install both. Use the following commands:</p><pre>pip install boto3<br>pip install awscli</pre><p>Next we need to make sure we are in the working directory from the AWS CLI. Run the following command:</p><pre>cd yourworkingdirectory</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/796/1*ahdHIjsY39rSYgEbZXSY_A.png" /></figure><p>Next we need to manually launch EC2 instances in AWS. I copied my ami and subnet information from my AWS account. You will need to run the following:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/840/1*MFu_dGnLeUcfs5ozRw4-fg.png" /></figure><p>Then the output will look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iYUdFRhKI7xqy6GV7tzzTg.png" /></figure><p>Now go to AWS, then Instances and look at the instances running. You should see what you to created in Cloud9.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jHK1b2MuSChcn-fxpC0wLQ.png" /></figure><p>Next go back to Cloud9 and save the changes you made and then push the code to your GitHub account.</p><p>Now we need to stop the instances. Make sure to copy your instance ID’s and paste them into the script.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-cmWPNCCtVy14xsIKQIqEg.png" /></figure><p>Then run the command to get the following output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*82igIHJOmtNlUMXZndJ_1A.png" /></figure><p>Now we need to go back to AWS to confirm that the 3 instances have stopped running.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ABROPSQHmLXzhgYTCfqh6g.png" /></figure><p>Next go back to Cloud9 and we need to save changes and then push the code to your Github. Then you will need to “merge the branch”. When you are done, you can the “Delete the branch”</p><p><a href="https://github.com/nylover85/maycohort2023/blob/9166a67ada8ce4026b7fa117c0bc455b726c291c/alyson.py">maycohort2023/alyson.py at 9166a67ada8ce4026b7fa117c0bc455b726c291c · nylover85/maycohort2023</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_HMvV7IybTRd_2b0mm11QQ.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5651da4c1a66" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Cloud 9 -Python: How to create a script that generates a list of dictionaries about files in the…]]></title>
            <link>https://medium.com/@mydevopsportfolio/cloud-9-python-how-to-create-a-script-that-generates-a-list-of-dictionaries-about-files-in-the-4494ddec2940?source=rss-4c9762d18e7a------2</link>
            <guid isPermaLink="false">https://medium.com/p/4494ddec2940</guid>
            <dc:creator><![CDATA[Alyson Coppola]]></dc:creator>
            <pubDate>Wed, 09 Aug 2023 02:02:42 GMT</pubDate>
            <atom:updated>2023-08-09T02:02:42.567Z</atom:updated>
            <content:encoded><![CDATA[<h3>Cloud 9 -Python: How to create a script that generates a list of dictionaries about files in the working directory.</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/978/1*ChliZ8S0q0kwnY2LJ-gMdA.png" /></figure><h4>* You will need an AWS account, a Github account and an IDE.</h4><p>To start, go to AWS then cloud 9 and create an environment. Next you will need to open that environment to connect. This will open the cloud 9 home screen. You will need to create a branch under main. Go to Github to verify that the branch you created shows under branches. Then go back to cloud 9 and save that branch under the python file and name it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LAP5e6Lb2aOsk2BALeaf7w.png" /></figure><p>Now while in the IDE, run the import os command.</p><pre>import os</pre><p>Next we want the list of files in the current working directory. Run this command:</p><pre>directory = os.getcwd()</pre><p>Now we need an empty list to store dictionaries, run this command:</p><pre>file_python = []</pre><p>Next, a for loops function is required to collect data from the files in the directory. Run the following syntax:</p><pre>for filename in os.listdir(directory):<br>  <br>  file_size = os.path.getsize(filename)<br>  modified_time = os.path.getmtime(filename)<br>  creation_time = os.path.getctime(filename)<br>  file_path = os.path.realpath(filename)</pre><p>Now we need to print out the list of dictionaries, run this command:</p><pre>print (*files,sep=&quot;\n&quot;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*t9qb016FAr6842HjEQqarw.png" /></figure><p>The output should look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_ISz1yENOTJsATRuXS_Jmw.png" /></figure><p>We are now done with that part. Next we will need to push our code to Github. First you need to stage changes on your file name that you created, and then put a message in for “made changes”. Then save it. Next an up arrow will appear on the bottom left corner of the screen, click that. This will push the information to your Github account.</p><p>Once in your Github account, go to “Pull requests”, you will see the file name you just pushed there. You will want to click on the green box that says “Compare &amp; pull request”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2KrjK-UMW3WKHhOruSLkZQ.png" /></figure><p>Next we want to merge our pull request. You will click on the green box that says “Create pull request”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/338/1*hBhvgw3AC9Kr7cn77zq9Tw.png" /></figure><p>Then you will check the box that says “Merge without waiting for requirements to be met (bypass branch protections) and then click on “Merge pull request”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3i6svzK7R4arkAayKgw9tA.png" /></figure><p>Then click “Confirm merge”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5L6BfhN29G200hje7JYmMw.png" /></figure><p>You will then get the following response:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e7agNv1kP6G77iPDC0phxA.png" /></figure><p>Lastly, you will want to click on “Delete branch”.</p><h4>The GitHub repository will now display it as the most recent update. The URL for it is provided below:</h4><p><a href="https://github.com/nylover85/maycohort2023/blob/51cacc4ac5c91e59238f8ff55226e4a95756c404/python13_file.py">maycohort2023/python13_file.py at 51cacc4ac5c91e59238f8ff55226e4a95756c404 · nylover85/maycohort2023</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/398/1*AKoFAa97NyOSMykccFWcQw.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4494ddec2940" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to create an EC2 Random Name Generator using Python.]]></title>
            <link>https://medium.com/@mydevopsportfolio/how-to-create-an-ec2-random-name-generator-using-python-3f1478b7fd97?source=rss-4c9762d18e7a------2</link>
            <guid isPermaLink="false">https://medium.com/p/3f1478b7fd97</guid>
            <dc:creator><![CDATA[Alyson Coppola]]></dc:creator>
            <pubDate>Thu, 03 Aug 2023 23:45:43 GMT</pubDate>
            <atom:updated>2023-08-03T23:45:43.019Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/516/1*D4PCBQceA9jGspcU4sM7ag.png" /></figure><h3>You will need an AWS account, Cloud 9 and Github.</h3><p>Once you have logged into to AWS, go to cloud 9 and create an environment. Then you will open it. This will then bring you to the cloud 9 home screen. You want to be under “main” to create a branch. Name it, then save it. Next you will create a file and name it. It needs to end in “.py” to work under python.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/332/1*x1q4KOQsciaMHMZzfjcmRg.png" /></figure><p>Next you will type in <em>import random, import string, import sys.</em></p><p><em>Import Random:</em> Defines a series of functions for generating or manipulating random integers.</p><p><em>Import String: </em>Arrays of bytes representing unicode characters.</p><p><em>Import sys:</em><strong><em> </em></strong>Provides various functions and variables that are used to manipulate different parts of the Python runtime environment.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/408/1*9Liwu4kpOlPQShD1bNK82g.png" /></figure><p>Next we need to define the string generator and the departments that will be able to use this program. The length of the name is stated with <strong>size=10.</strong></p><p><em>ascii_letters:</em> Pre-initialized string used as string constant. This means that regardless of the request, the user will receive a name that has upper- and lower-case letters without the programmer needing to specify each and every single outcome.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xMS3v_nN_5mPddxe_-UkMQ.png" /></figure><p>The user does not need to worry about if they capitalized the department or not as long as it is spelt correctly. Also, at the end of the code make sure to add a prompt asking “How many do you need?”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sCxXuYPZAmW0rxHrJMenng.png" /></figure><p>Next we will need to print out the names for the departments.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mjx8vbpsaMeNgAQOECoJYw.png" /></figure><p>Then hit <em>“Run”</em> to see the outcome.</p><p>After you hit <em>“Run”</em>, on the terminal, it will state the departments you made. If you hit enter again, it will ask you “How many do you need?” Enter 4. Then hit enter again, names are generated.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/992/1*9frmYwcVSaa1Ni9cqQrmtQ.png" /></figure><p>You have now completed creating a name generator!</p><p>Below is my Github link for the code we did.</p><p><a href="https://github.com/nylover85/maycohort2023/blob/9c7735cd73a3cbf69bccfcb53a09da6543c6617a/Name_Generator.py">https://github.com/nylover85/maycohort2023/blob/9c7735cd73a3cbf69bccfcb53a09da6543c6617a/Name_Generator.py</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*3GYyWv5l-wnV5oqy.jpg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3f1478b7fd97" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AWS 3-Tier Architecture]]></title>
            <link>https://medium.com/@mydevopsportfolio/aws-3-tier-architecture-3e44f26770fb?source=rss-4c9762d18e7a------2</link>
            <guid isPermaLink="false">https://medium.com/p/3e44f26770fb</guid>
            <dc:creator><![CDATA[Alyson Coppola]]></dc:creator>
            <pubDate>Mon, 24 Jul 2023 17:18:50 GMT</pubDate>
            <atom:updated>2023-07-24T17:18:50.492Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*wj-8hJWbpaBu9M3kkDHnFA.png" /></figure><h4><strong>What is a three tier architecture?</strong></h4><p>It’s an architecture that consists of 3 tiers: It is a software architecture pattern that divides an application into three distinct layers or tiers: the presentation tier, the application tier (also known as the business logic or processing tier), and the data tier. Each tier has a specific role and set of responsibilities, promoting modularity, scalability, and maintainability in the overall system design.</p><h4>What are the benefits of a three tier architecture?</h4><p>Organization, flexibility, faster problem solving, improved security and better performance. It helps solve problems quickly, performs well under high traffic, and keeps your information safe.</p><h4>Pre-requisites-</h4><p>AWS account using VPC and EC2.</p><h3>Create a Web Tier</h3><p>First we will need to create a VPC. Go to AWS, go to VPC, Create VPC and then choose the VPC and more option. Because we are creating a VPC with multiple subnets, availability zones, and more, you will want this option.</p><p><strong>Under VPC Settings fill out the following:</strong></p><p><strong>Name VPC:</strong> or choose Auto-generate</p><p><strong>IPv4 CIDR block: </strong>10.0.0.0/16</p><p><strong>IPv6 CIDR block: </strong>No IPv6 CIDR block</p><p><strong>Tenancy:</strong> Default</p><p><strong>Availability Zones:</strong> 2</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/944/1*0zHOAN7G5aP_wxa0vBXBzQ.png" /></figure><p><strong>Public Subnets: </strong>2</p><p><strong>Private Subnets:</strong> 4</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/1*embendxjskdB58zERiKu2w.png" /></figure><p><strong>NAT gateways:</strong> In 1 AZ</p><p><strong>VPC endpoints: </strong>None</p><p><strong>DNS options: </strong>check enable DNS hostnames and check Enable DNS resolution.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6gp8HdJj--Uk0417d6qCXw.png" /></figure><p>Next click “<em>Create VPC”</em>. It will then show you the VPC workflow being created.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AX1Qi3wn4L05GfCGw13Z9A.png" /></figure><p>Click V<em>iew VPC</em> next. This will show you the details of what we just did.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qxhshivMmCSuvO3aTVKRSg.png" /></figure><p>Next go to “Subnets” on the left side menu of the VPC console and select one of the public subnets you have created. Under the “Actions” tab, expand the down arrow and select “Edit subnet settings.” Click “Enable auto-assign IPv4 address” and “Save.” Do this for both of your public subnets.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*G-SzhZL5Ixp6nXFkgQth0w.png" /></figure><h4>Create an instance using a free tier OS in an Auto Scaling Group</h4><p>First we will need to launch an instance. Go to EC2 console, click “Instances,” then “Launch instances.” Give the instance a name, select an AMI, select an instance type, and create a key pair.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yCfWFw6Q-bP8TXgEIQWxhw.png" /></figure><h4>Set a Security Group allowing inbound permissions</h4><p>Next, Under the Network settings Click “Edit” and select the VPC you just created. Then select one of the public subnets you just created. For “Auto-assign public IP,” choose “Enable.”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KHBm9l1dpLibN23tlOHKkg.png" /></figure><p>Next go to Firewall settings. Choose “Create security group”. Name it and give it a description. For Security group rule 1 select “ssh” for type and “Anywhere” for source type. This will allow all inbound traffic on port 22. For Security group rule 2 select “HTTP” for type and “Anywhere” for Source type. This will allow all inbound traffic on port 80.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hcIpBu4531-mrZbXqGW8Ug.png" /></figure><p>Next, go to Advanced details section and scroll all the way to the bottom where you see user data. We want our public IP address to point to a custom company site. We can have Apache web server launch at the time of the instance launch by putting a script in the user data field. The following script will install Apache and lead to a custom site that says “Company Website.”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*szFGRv-d4TAvSjg77kfhpQ.png" /></figure><p>Then Click “Launch Instance”. Your screen should then show a green banner saying success.</p><p>In the EC2 console, select “Auto Scaling Groups” from the left side bar menu, then click the orange “Create Auto Scaling group” button. Give the auto scaling group a name and click the blue “Create a launch template” link.</p><p>Now you will need to name the Launch template and description. You will also choose the AMI. The Instance type is still t2.micro.</p><p>Select key pair that was previously made.</p><p>In Network settings, select existing security group, and choose the one that was recently created.</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*KavDFFjz1zVxdH0H2QTZtg.png" /></figure><p>Now go to EC2, instances, and click on the Instance ID. Copy the Public IPv4 address and paste it into the search engine to test it.</p><p>If it works, you will see the below image on the screen.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Jbk-tCluH9tD1nzGsc_n8A.png" /></figure><p>Next under Advanced details, include the same user data that you did previously. Then click “Create launch template”. You will then see a green banner on the top of your screen that says success.</p><p>Go back to the Auto Scaling Group page, refresh the launch templates, then select the launch template you just created. Click “Next”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5Lv9OhCjZLuIDDICf7cfVQ.png" /></figure><p>Under Network, select the VPC you just created, and then for Availability Zones, select the 2 public subnets. Then click “Next”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*L5J3bbjNDzgShTcFe9WyTQ.png" /></figure><p>Under Configure group size, select the capacities. 1,1, 2.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-Xk5GXyr8eFBT2L2oOWZKA.png" /></figure><p>Under Scaling policies, select “Target tracking scaling policy”. The information below will auto-populate in. Then click “Next”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CQa_MYxdOJ4a7nwON3SGCg.png" /></figure><p>Next you will be on the Review page, scroll down and click “Create Auto Scaling group”. You will see a green banner across the top of your screen saying success.</p><h4>Create a public route table and associate the 2 public subnets.</h4><p>We created these earlier, now we need to confirm that VPC and subnets are associated correctly. Go back to the VPC dashboard and on the left side menu select “Route tables.” Select the web tier public route table and view the associated subnets. It should be the two public subnets we created.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ooERc5Dc-bI092eHXcqs0w.png" /></figure><p>This looks correct, so our web tier is now complete.</p><h3>Create an Application Tier.</h3><p>Go to EC2, Instance, launch instance. Name it. Choose AMI, instance t2.micro. Select key pair, go to network settings, click edit. choose VPC previously made. Choose one of your private subnets that was created earlier.</p><p>Create Security group, name it and give it a description.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OXsa_iy9-k9Z7PN_MtrjvQ.png" /></figure><p>Go to Security Group rule 1, ssh, custom, then go to source and hit search and pick the security group that was created earlier.</p><p>Next create rule 2, HTTP, anywhere, PORT 80</p><p>Next create rule 3, MYSQL/Aurora, anywhere.</p><p>Add a security group rule 4 all ICMP IPv4 custom (or anywhere if it doesn&#39;t ping).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MPpYrPfw84Z9waNkG6rm4g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TrPGWF_-V0CwU8zAVUro3A.png" /></figure><p>To ping you need the All ICMP</p><p>Now go to advanced details , scroll down to user data and copy command and paste the command from earlier, then hit launch instance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tr5V3U7MynvzyOTabf4gDw.png" /></figure><p>You will then see a green banner that says success.</p><h4>Database Tier</h4><p>Go to EC2, autoscaling, Create an autoscaling group, name it. click create launch template, name template</p><p>Choose AMI and instance from before</p><p>Choose key pair from before</p><p>Under subnet choose :don’t include in launch template</p><p>Choose security group from before</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JQzVLbsK5cM-J5rE8X-drA.png" /></figure><p>Next create launch template, then you will see a green success banner on your screen.</p><p>Now go back to auto scaling group under EC2 and click create auto scaling group, name the auto scaling group and click previous made auto scale template. Then click next.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*g4PObs4WILB4t-EgNVwqlQ.png" /></figure><p>Under Network, choose correct VPC and select the public availability zones and subnets. Then click next.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PVROGv4nSauk5okHkQU9Nw.png" /></figure><p>No load balancing option, continue on until you get to Configure group size and scaling policies.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n5h7uT5CDpcTaX7n2HNzmA.png" /></figure><p>Scaling policies: none</p><p>Click next until you get to review, scroll down to “Create Auto Scaling group”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FY_kvfWtkLwenOqifkm1kg.png" /></figure><p>Now go to EC2, Instance, Launch an instance.</p><p>Name the instance, choose the AMI, choose the instance type, and a key pair from before.</p><p>In network settings select correct VPC, then pick subnet private 1 east</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6EItiJ84H7z9X8eEOzmqzQ.png" /></figure><p>Create security group, name it.</p><p>Security group rule 1 type is MYSQL/Aurora, source type is custom, then choose security made earlier from application tier.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Z3hFRwR120eZmptrab3i9w.png" /></figure><p>Next click launch instance</p><p>You will see a green success banner</p><p>Now go back to auto scaling group under EC2 and click create auto scaling group. Name the Auto Scaling Group. Click create auto scale template, name it, choose the AMI, Instance t2.micro, choose key pair that was previously created.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Tbw17lzK4eQELTA5hFh_xw.png" /></figure><p>Now under Network settings, choose AMI instance and key pair , choose existing security group. then click create launch template.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xa4uXeT6wVIfzeiOxfskUA.png" /></figure><p>You will then see a green banner on the top of your screen that says success.</p><p>Now go to EC2, Auto Scaling groups, Create Auto Scaling group. Name it, click “next”. Then under Network, select the correct VPC, then under Availability Zones and subnets choose the 2 private VPC’s created from earlier. Then click “Next”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y2lVteVQ_EOj3foM5Q5OLg.png" /></figure><p>The next screen will ask if you want to attach a load balancer, you will select “No load balancer”. Click “Next”.</p><p>Under Configure group size and scaling polices, choose 2,2,2.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C8ipGrOKJqOXupz-LQml8w.png" /></figure><p>Under Scaling policies, select “Target tracking scaling policy”. The information below will auto-populate in. Then click “Next”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*se6L9vSJyPFJ4K-lhrpR2g.png" /></figure><p>Continue on to the Review page and scroll down to “Create Auto Scaling group”. You will then see a green success banner on the top of the screen.</p><p>Now we need to go to RDS. Then go to Databases and then click “Create database”. Select Standard create. For Engine options select “MySQL”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BjGtZq9t2y1zfvxCbaTkqQ.png" /></figure><p>Next choose the Free tier for Templates</p><p>Next go to Settings. Name the DB instance identifier. Set a Master password as well.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/746/1*3-TjXeJJm9lDZ_IoHo54VA.png" /></figure><ul><li><strong>Make sure you save your username and password. You will need it to connect to your database.*</strong></li></ul><p>For Instance configuration and storage, you can adjust if needed. I left those as default settings.</p><p>Next under Connectivity we will enter the following..</p><ul><li>Select Dont connect to an EC2 compute resource.</li><li>Select the correct VPC</li><li>DB subnet group” Create a new DB Subnet Group</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9XlWbwLWH7gJ3wnVqbPX2w.png" /></figure><ul><li>Public access: Select “No”</li><li>VCP security group: Select choose existing. Then select the correct security group.</li><li>Availability Zone: us-east-1a</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*YCl9cTMQnGs_fdVtA1RnLw.png" /></figure><p>Then scroll down to “Create database” This may take a few minutes to launch. You will then see a green success banner at the top of your screen.</p><p>Now go to VPC, Security, Security groups, then find the DB security group you created. You will see that the inbound rule type is set as “MYSQL/Aurora”. We need to edit inbound rules, delete this option.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Mn_pEvZU6q9s0NjlgDYOgA.png" /></figure><p>Next, you will Add rule. For type you want MYSQL/Aurora, for Source you want custom, the click the search box and type in sg to then find the application tier security group you created associated with DB. Then click “Save rules”. You will then see a green success banner at the top of your screen.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*x98nj6_vuBkc6Cj_ov-qwA.png" /></figure><h3>Update Tier 3 Private Route Tables</h3><p>Under VPC, go to Route tables. Select the private route table that you want to associate with your database tier private subnets, then click the Subnet associations tab to see if they are correctly associated. If they are not, you can edit subnet associations to add the correct subnets.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*g9bq2CxhqnOmU70L1CDR4A.png" /></figure><p>We have now completed making our 3 tier architecture.</p><h3>Testing Connectivity</h3><p>Go to EC2, Instance, choose the public web app tier and start instance, then copy the public IPv4 address and then paste it in the search engine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xZEIEljUXQDkQEMLTir8pA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZEGPN6lHgFUcr1DSDmQVbQ.png" /></figure><h3>Ping Tier 2 from Tier 1</h3><p>Go back to Instances, select the application tier, start instance. Copy the private IPv4 address. Go to your terminal, type ping then copy the address and hit enter.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/888/1*8I7iz63YjvA4US1MkopS5Q.png" /></figure><p>Now both web tiers can communicate with each other.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/886/1*mo7E_mdpQYX1ODeX-kUwnA.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3e44f26770fb" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>