Skip to main content

Posts

Showing posts from March, 2018

CONFIGURING LOAD BALENCER WITH AUTOSCALING GROUP

Consider we have a auto scaling group running with three instances.Now we have to create a load balencer. From ec2-dash board click on load balencer > Application Load Balencer >In configure load balencer give name,type and so on.Also we have to select vnet and subnets we want to add.Here we will add our all 3 sub nets since vm in our ASG are under 3 subnets.Click next. Now select our security group and click next.  On configure Routing we have to specify our target group.we can select new target group and give name for it.Now select protocol which is HTTP, port 80, and target type as intance.Also select the path.we will keep it as / itself.Thenk click next. Here we dont want to add any instance since we want to configure load balencer with ASG.Now click next and click create. Wait for 10 minutes till our load balencer is ready.Now go to our auto scaling group.Click on edit.Under target group give the name of our target group which is asg-3ec2.

PLACEMENTGROUPS IN AWS

Placement groups are recommended for applications that benefit from low network latency, high network throughput, or both. >AWS recommend to use same instance type for all instances in the placement group >They can be of two types- cluster or spreaded >A cluster placement group is a logical grouping of instances within a single Availability Zone. >A spread placement group can span multiple Availability Zones, and you can have a maximum of seven running instances per Availability Zone per group.A spread placement group is a group of instances that are each placed on distinct underlying hardware. >Name of Placement group should be unique >An instance can be launched in one placement group at a time; it cannot span multiple placement groups. To create a placement group.From ec2 dashboard click on placement groups.Give name and stratagy.Stratagy can be either cluster or spreaded. Then follow normal steps as creation of an ec2 instance.While selecting ins

JENKINS:EXECUTE JOBS IN PARALLEL

Assume that we have master slave node Jenkins setup with two slavenodes running. Create two jobs for slave1 and slave1.Now give build now for slave1 and then for slave2.We can see that slave2 project is waiting till first one is over. We can overcome this issue. For that we have to enable execute concurrent builds if necessary for both slave1 and slave2.Click on down arrow near the project name > Configure Now enable execute concurrent builds if necessary and save.Now run both jobs at same time.We can see both builds occur in parallel.

ATTACHING AND EXTENDING VOLUMES IN AWS EC2

Attaching new volume : Go to Volumes > Click on create Volume Here on Volume Type select which type of volume we want.It can be General Purpose SSD,Provisioned IOPS SSD, Cold HDD,Throughput Optimized HDD or Mangnetic.Here we will go with General purpose SSD. Then give the size of disk we want.we will go with 12 GB. Select Availability zone.Check Availability zone where our ec2 instance is located.Here we will go with us-west-2b. Note:The new volume should be in the same availability zone where the ec2 instance is running to which we want to attach. If we want to create volume with new snapshot.select snapshot id. If we want to encrypt it tick encrypt this volume.Then click create volume. After creating volume select the volume, From Actions > Attach volume. From here select our ec2 instance id and click ok. Now login to our linux vm and confirm that new volume is attached by using lsblk command To mount the attached disk #fdisk /dev/xvdf Afte

CREATING IMAGE FROM EC2 IN AWS

Inorder to create an image from vm.Select the ec2 instance.From Actions > Image > Create image Here give image name , image discription and othe details.We will untick on no reboot .It means that vm wii stop then create image and then start again.We need to select "No reboot" if we don't want our instance to be shut down. If "No reboot" is selected, we can't guarantee the file system integrity of the created image.Then we can specify root volume size.We can change the default value so that newly created instance from the image will have that size.Similarly we can also add a new volume in this step so that newly created instance from that image will have that attached volume.Then click create Image. We can see new AMI image and a snapshot for it is created.

JENKINS ON EC2: SETTING MASTER SLAVE NODE

In this tutorial we will setup a Jenkins master slave setup. Here we have a master and slave ec2 instances running in aws. Assume we have two ec2 ubuntu instances running.One will be master and other will be our slave. First on master we will install Jenkins. INSTALLING JENKINS Add the repository key to the system #wget -q -O - https://pkg.jenkins.io/debian/jenkins-ci.org.key | sudo apt-key add - Next, we'll append the Debian package repository address to the server's sources.list: #echo deb https://pkg.jenkins.io/debian-stable binary/ | sudo tee /etc/apt/sources.list.d/jenkins.list Now update #apt-get update Now install jenkins #apt-get install jenkins Then we will start and enable Jenkins service #systemctl start jenkins #systemctl enable Jenkins Now install github and maven integration plugins. Manage Jenkins > Manage plugins > select github integration Now on Configure  global security , uder agents give random for jnlp port.This will e