Posts

Showing posts with the label aws-ec2
Image
 Setup kubernetes multi-node cluster on AWS  There are a number of ways to setup k8s cluster either on your workstation or VM or cloud. Even major cloud providers also give k8s cluster as a service. To setup k8s multi node cluster I am using AWS EC2 instance one master and one worker node with below specifications: 2 EC2 instances  Amazon Linux 2 AMI 64-bit (x86) Instance Type:- t2.micro 1vCPUs, 1GiB Security group:- enable all traffic. (not a recommended approach but to keep things simple ) First install docker as k8s needs a container engine to launch containers. sudo su - root yum install docker -y Start docker service and enable it to restart automatically after system reboot. systemctl enable docker --now To install kubeadm (main tool to install k8s multi node cluster) we have to configure yum repository for kubernetes as below cat <<EOF | sudo tee /etc/yum.repos.d/kubernetes.repo [kubernetes] name=Kubernetes baseurl=https://packages.cloud.google.com/yum/repo...

AWS EC2 instance with custom security group rules

Image
Hello all, Today we are going to create an AWS EC2 instance with customized rules in security group that allow only specific hosts to connect to it and ping it. So first login to your AWS account and select a region where you want to create an EC2 instance. I am going to use Mumbai region (ap-south-1) . Next click on Launch instances button and below page will appear: Select any AMI [Amazon Machine Image] of your preferences, I am selecting  Amazon Linux 2 AMI . Then select the instance type from below webpage, I will choose t2.micro and click on Next button In instance details page either you can choose default values and click on Next or you can configure some options. I am selecting Subnet option as Default in ap-south-1a and clicking on Next button.   In Add Storage page give size as per your requirement. I'll go with the default option [8 GiB]. In the next page we can add tags to this instance so we can refer to this instance using this tags. We can add multiple ...

Create AWS EC2 instance with webserver installed using Ansible

Image
Hello all, in this blog we are going to learn how to provision/create/spawn an AWS EC2 instance using Ansible tool. We will make all the steps automatic so that our ec2 instance will be created and a webServer starts running without any manual intervention. We will write two ansible roles: One for creating aws ec2 instances with desired ingress port opening Another for installing and configuring apache webserver Go to ansible default role path . cd /etc/ansible/roles and create two ansible roles using below commands ansible-galaxy init ec2_instance ansible-galaxy init custom_webserver Paste the below content in ec2_instance/tasks/main.yml --- # tasks file for ec2_instance ######################################################## ##### Below file is required to login aws account ####### - include_vars: secure.yml ##################################################### ###### Creating a security group for ec2 instance ### - name: create a security group ec2_group: name:...