Skip to main content

Posts

CREATING EC2 INSTANCE UNDER NEW VPC AND SUBNET USING ANSIBLE

Managing aws resources using Ansible is efficient and reliable. In this document we will create an ec2 instance using Ansible under a new vpc and subnet. For that we will do the following 1) Creating a VPC 2)Creating a subnet 3)Creating an internet gateway and routing table for vpc 3)Creating a security group 4)Creating an ec2 instance Our directory structure for ansible playbook is as follows Here we have an aws role which will execute creating of a new ec2 instance under new vpc and subnet. The main.yaml file under tasks is as follows: Here in our playbook first we will create a VPC.We will specify region,name,cidr-block over here.We will register it as my_vpc. On next step we will save its id which we will use while creating subnet. Similarly we create Internet gateway and routing table to that vpc. Then we will create a n security group allowing traffic through certain ports.Next we created a ssh key pair for our ec2 instance and saved the private k...

AWS RDS: CREATING AN RDS INSTANCE

Amazon Relational Database Service (Amazon RDS) makes it easy to set up, operate, and scale a relational database in the cloud.In this article we will explain about creating a mysql database using aws RDS. From AWS RDS dashboard click on instances > Then click on Launch DB instances. First we need to select engine.Here we will go with Mysql engine.Then click next.On the next window appears we will select our use case.We will go with Production-Mysql and click next. On the next window that appears we can select various options such as mysql version ,instance class,storage type,size multi-az deployment and so on.Here we selecting t2-micro as size, storage type as general purpose SSD and mysql version as mysql 5.6.39.Also we are not going with multi-AZ deployment.We can also see estimated cost over here. Under settings we can give the db identifier name.Also we can give username and password for it. Under network and security give the details about subn...

WORKING WITH VOLUMES AND PERSISTENT DATA IN DOCKER

We can use volumes with docker for persistent storage.To create a volume use command #docker volume create mytestvol This will create a volume named mytestvol. To list it #docker volume ls We can see our volume mytestvol is listed in it. To inspect that #docker volume inspect mytestvol The volumes that we create will be created inside /var/lib/docker/volumes.Go inside that folder and we can see that our volume mytestvol is present there To delete a volume #docker volume rm mytestvol2 Here mytestvol2 is the new volume that we created. Now we will check how to mount a volume to a container. #docker container run -dit --name mygoof --mount source=volpool,target=/vol centos:centos6 Here docker will run a new centos6 container with a new volume named volpool attached to /vol directory of centos container.Here docker will create a new volume automatically.Now check #docker volume ls We can see new volume volpool is created #docker ps We can see our container named m...

DOCKER SWARM WALKTHROUGH

Swarm is native clustering for the docker. When docker engine runs in swarm mode, to manage cluster state manager node implement the Raft Consensus Algorithm. In this article we will setup one manager node and 3 worker nodes which are separate virtual machines running in AWS. Pre-Requisites: > Docker installed and running on all instances.                           > Static IP for all instances                           > Network connectivity between all instances                           > Ports 2377 (network communications),7946(swarm node communication),4789(overlay network) should be open. First go to our manager node.Now to check whether swarm is active or not #docker system info | grep Swarm Now to initialize # docker swarm init or else we can also give #...