<?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 Ayla Dursun on Medium]]></title>
        <description><![CDATA[Stories by Ayla Dursun on Medium]]></description>
        <link>https://medium.com/@ayladursun?source=rss-4bb598c36854------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*7sjQQCUS_0nZSIlM</url>
            <title>Stories by Ayla Dursun on Medium</title>
            <link>https://medium.com/@ayladursun?source=rss-4bb598c36854------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 11:23:35 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ayladursun/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[Git on EC2]]></title>
            <link>https://medium.com/@ayladursun/git-on-ec2-26d910f2fe28?source=rss-4bb598c36854------2</link>
            <guid isPermaLink="false">https://medium.com/p/26d910f2fe28</guid>
            <category><![CDATA[git]]></category>
            <category><![CDATA[ec2]]></category>
            <category><![CDATA[linux]]></category>
            <dc:creator><![CDATA[Ayla Dursun]]></dc:creator>
            <pubDate>Mon, 30 Sep 2024 17:21:41 GMT</pubDate>
            <atom:updated>2024-09-30T17:21:41.847Z</atom:updated>
            <content:encoded><![CDATA[<p>Hello everyone, I’m excited to guide you through some fundamental Git skills, tailored for those beginning their Git journey. Whether you’re new to Git or looking for a refresher, mastering these basics will help you become proficient and productive with Git. Let’s get started!</p><p><strong>Notes</strong>:</p><ul><li>You need to have a Git account. We are going to use Git username and email associated with the Git account.</li><li>I used simple Python scripts for demonstration purposes, but you can implement more complicated ones.</li><li>All part of the project is undertaken on Cloud (AWS EC2).</li><li>You need to have an AWS account.</li><li>EC2 instances are not free, be sure to terminate after your project is done.</li></ul><h3>Steps</h3><ol><li><strong>Ec2 Launch:</strong> You can launch an instance with below features.</li></ol><p>. Amazon Linux AMI, t2 micro server type, 8 GB storage.</p><p>2. Connect to Ec2 using <em>ssh</em>.</p><p>3. After connecting your Ec2 you can install Git using following commands to;</p><ul><li><em>sudo yum update -y</em></li><li><em>sudo yum install git -y</em></li><li><em>git — version (two dashes)</em></li><li><em>git config — global user.name “Your Name” (two dashes)</em></li><li><em>git config — global user.email “your_email@example.com” (two dashes)</em></li></ul><p>4. Use this command to see the information about your config file;</p><ul><li><em>git config — list (two dashes)</em></li></ul><p>you can check your username and email.</p><p>5. Now we can work with Git.</p><ul><li>First, create a new repo on your GitHub account. (This repository should be public)</li><li>Take the repository URL(https), go to EC2 and use this command;</li><li><em>git clone </em><a href="https://github.com/yourusername/reponame"><em>https://github.com/”yourusername”/”reponame</em></a><em>”</em></li><li>List it; <em>ls </em>or<em> ls -la</em></li><li>Go to your directory with<em> cd yourdirectoryname </em>(new repository)</li></ul><p>6. Use these commands to associate your repo with your Ec2.</p><ul><li><em>git init</em></li><li><em>git add .</em></li><li><em>git status</em></li><li><em>git commit -m “first commit”</em></li><li><em>git branch -M main</em></li><li><em>git remote add origin </em><a href="https://personalaccesstoken@github.com/yourgit"><em>https://personalaccesstoken@github.com/</em></a><em>username/reponame</em></li><li><em>git remote -v</em></li><li><em>git push origin main</em></li></ul><p>7. At this stage, Git may prompt you to enter your username and password. You should enter your username, and instead of your password, use a personal access token. After push is done, you can see your repo and Ec2 having the same files or directories.</p><p>8. Then, start by creating a branch. Use this command to create a new branch named ‘dev’. With this branch, another team (e.g., developers) in your work environment can work separately on the source code.</p><ul><li><em>git branch dev</em></li><li><em>git checkout dev </em>(now on your EC2 you can see “dev” branch but in your repo you can not see it yet)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*moxxn-J1fSdXxisV" /></figure><ul><li><em>git push — set-upstream origin dev (two dashes) </em>( after this command you can see the dev branch in your github repo)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*6AK5Hjfaic9Kn6Jr" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*jCixw0_1AOWJQPip" /></figure><p>9. If you want to create another branch, first check out the main branch, then create a new one for the other team. Use the following commands:</p><ul><li><em>git checkout main </em>(I am creating a new branch that reflects the main branch that’s why I checkout main first then create a new branch .)</li><li><em>git branch release</em></li><li><em>git checkout release </em>(now on your EC2 you can see release branch but in your repo you can not see it yet)</li><li><em>git push — set-upstream origin release (two dashes)</em>( after this command you can see the release branch in your github repo)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*e7chFXlqNpN-9aZr" /></figure><p>Now you can see all your local and remote branches.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*_N5b2FZcFRFQWN6t" /></figure><p>10. At this stage, we will create new files and merge them into the dev branch in our repository.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*kTO3XZR02HWHN7Xv" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*5zphSMrYkZ7CYyMK" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*bra1ip_xcViQidqq" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*XrslRONRACyv0i_z" /></figure><p>11. In summary, we have completed the following steps:</p><ol><li>Created an EC2 instance</li><li>Installed Git</li><li>Created a Git repository</li><li>Created git branches</li><li>Created new files in different branches</li><li>Merged these files into our remote repository</li></ol><p><em>Thank you for joining me on this topic. I appreciate your time and engagement. Stay tuned for more interesting discussions in the future! Thank you for reading, your suggestions and questions are always welcome!</em></p><p><strong><em>Ayla Dursun</em></strong></p><p><em>Cloud and Devops Engineer</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=26d910f2fe28" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Ansible on EC2]]></title>
            <link>https://medium.com/@ayladursun/ansible-on-ec2-233069805f33?source=rss-4bb598c36854------2</link>
            <guid isPermaLink="false">https://medium.com/p/233069805f33</guid>
            <dc:creator><![CDATA[Ayla Dursun]]></dc:creator>
            <pubDate>Tue, 07 May 2024 14:00:32 GMT</pubDate>
            <atom:updated>2024-09-21T17:05:04.037Z</atom:updated>
            <content:encoded><![CDATA[<p>Hello everyone, in this post, I will explain how to set up a web application project hosted on EC2 and provisioned by Ansible for beginners.</p><p><strong>Notes</strong>:</p><ul><li>You need to have an AWS account.</li><li>EC2 instances are not free, be sure to terminate after your project is done.</li><li>I used a simple html file for demonstration purposes, but you can develop a more complicated web application.</li><li>All part of the project is undertaken on the cloud using EC2s.</li></ul><h3>Steps</h3><ol><li><strong>Security Group</strong>: To access Security Groups in your AWS account, navigate to the EC2 service. On the left-hand menu, under the ‘Network &amp; Security’ section, you’ll find ‘Security Groups’.</li></ol><p>2. Create a security group named Ansible-sg. The inbound rules should be as follows:</p><ul><li>Allow SSH from anywhere.</li><li>Allow HTTP from anywhere.</li><li>Allow custom TCP port 8080 from anywhere.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*wb0YWONrt6behFcX" /></figure><p>Outbound rules:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*LWcD-p9gP-v5l78Z" /></figure><p>3. Create three <strong>EC2 instances</strong>; name one instance ‘control-server’ and the other two instances ‘web-1’ and ‘web-2’. You can set EC2 attributes as follow:</p><p>- AMI: Amazon Linux 2</p><p>- Instance type: t2-micro</p><p>- Role: no IAM role</p><p>- Key pair: If you already have one you can use it. If you don’t, you can continue without a key pair for this project.</p><p>- Firewall: Ansible-sg</p><p>- Storage: You can use the default 8 GiB..</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/313/1*b-2GvzhaVQjWTHKsibeDng.png" /></figure><p>4. You can connect to your instances as shown below without using a<strong> keypair</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*aQNkuK0bl3vYAde8" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*rmPPltN9f-RoBfEi" /></figure><p>5. On the control-server, install <strong>Ansible</strong> using the following commands:</p><p><em>yum update -y</em></p><p><em>yum install -y epel-release</em></p><p><em>yum install -y ansible</em></p><p><em>amazon-linux-extras-ansible2 -y</em></p><p><em>ansible — version</em> (see the version of Ansible)</p><p>6. Generating a key for the servers to allow Ansible to connect to them. Generate a key on the control-server and copy the public key. Paste this public key into the <em>.ssh/authorized_keys </em>file on both the web-1 and web-2 servers.</p><p><em>ssh-keygen -t rsa</em></p><p>7. On the master, use the code below to view the configuration file and make edits as necessary.</p><p><em>cd /etc/ansible</em></p><p><em>edit →command out →inventory and sudo</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*4Y0jDuHJtKh2SXMS" /></figure><p>8. To view the original hosts file located in /etc/hosts, you can use the command cat /etc/hosts. After reviewing it, you can move the original file and create a new hosts file using the following commands:</p><p><em>mv hosts hosts.BKUP</em></p><p><em>Nano hosts</em></p><p><em>add [web] and Private IPs of web-1 and web-2 server.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*jp2nqBERJP3o_nkJ" /></figure><p>9. On the master, I verify the server connection using the following command and observe successful results.</p><p><em>ansible web -m ping</em></p><p>10. Create a new folder in<em> /etc</em>.</p><p><em>mkdir playbooks &amp;&amp; cd playbooks</em></p><p><em>copy and paste the httpd-server.yaml file</em></p><p><em>mkdir /home/ec2-user/src</em></p><p><em>nano /home/ec2-user/src/httpd.conf</em></p><p><em>(You can find the file in my github account </em><a href="https://github.com/ayladrsn/Ansible-EC2-webpage"><em>https://github.com/ayladrsn/Ansible-EC2-webpage</em></a><em> )</em></p><p>11. In the httpd.conf file, there is a simple HTML file with the content ‘HELLO DEVOPS WORLD’.</p><p>12. Afterward, check the result using:</p><p><em>ansible-playbook playbooks/httpd-server.yaml -i hosts</em></p><p>13. At the end, I observed that the index.html file is present on my web-1 and web-2 servers at the path</p><p>/var/www/html/index.html.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*P0PKCIQbyH84HVG2" /></figure><p>14. As a result, when accessing the public IP of web-1 or web-2, I see the message ‘HELLO DEVOPS WORLD’.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/0*kwk6y0ED_nEMnwaO" /></figure><p><em>Congratulations on completing the project! Thank you for reading,our suggestions and questions are always welcome!</em></p><p><strong><em>Ayla Dursun</em></strong></p><p><em>Cloud and Devops Engineer</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=233069805f33" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>