Use AWS CLI to automate the removal and addition of instances in your ELB

Posted by: Admin  :  Category: Web Hosting

Linux Cpanel shared hosting: 600 GB disk space, 6 TB bandwidth, free domain, unlimited databases and ftp accounts, web hosting cheap and pro at Hostony

Hello!

Sometimes its necessary to automate the removal and addition of instances in your elastic load balancer. Perhaps for the purposes of auto scaling or deploying updates to your web application. Either way, there is many tools at the disposal of the systems administrator to automate this process. Below we will share some simple steps as well as some (very) simple scripts to make it that much easier to manipulate the instances that are receiving live traffic via the ELB.

Install AWS CLI

This is pretty straightforward (and obvious). Amazon themselves provide a great guide to installing the AWS Cli toolset on your linux distribution. Below I’ll provide the shorthand for setting up AWS Cli on CentOS/RedHat or Ubuntu/Debian systems.

CentOS/RedHat

yum install aws-cli

Ubuntu/Debian

apt-get install awscli

So simple, right? There are other ways to install the toolset, such as through Python or to download the source and install directly from the source. After installing it, you will want to configure it with the access credentials in order to authenticate against your AWS account :

aws configure

Before you do that, it might be a good idea to create a new IAM user with restricted access.

Create IAM user in AWS Security Console to access only your ELB

Restricting access for your IAM user is a good best practice. It will ensure that the access you delegate will never go beyond what was originally intended and will also mitigate any damage a malicious user might do should they be able to gain access to the credentials.

What you would want to do is create a group first, with the following two policies attached : AmazonEC2ReadOnlyAccess (a pre-made policy that you can search for and attach automatically), and a custom policy detailed below.

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "Stmt1479414049000",
            "Effect": "Allow",
            "Action": [
                "elasticloadbalancing:DeregisterInstancesFromLoadBalancer",
                "elasticloadbalancing:DescribeInstanceHealth",
                "elasticloadbalancing:RegisterInstancesWithLoadBalancer"
            ],
            "Resource": [
                "arn:aws:elasticloadbalancing:us-east-1:113224244507:loadbalancer/your-elb-name"
            ]
        }
    ]
}

The policy above will allow the users in the IAM group to only access the specified ELB (where “your-elb-name” is specified). If you are in a different availability zone, you would also want to change us-east-1 to whatever zone your in.

Linux Cpanel shared hosting: 600 GB disk space, 6 TB bandwidth, free domain, unlimited databases and ftp accounts, web hosting cheap and pro at Hostony

Once the policy is attached to the group, then you simply need to create the user, add them to the group you created and create the access credential key/secret to use with the aws configure command.

The purposes of the script for us was to create a script on each actual instance so that we could simply run the script locally and automatically take the instance out of the pool. This means, for us, we ran the aws configure command on each instance that the script was running on. If you are using a centralized server (i.e. Jenkins, Ansible, Puppet, etc) then your script may look different. Perhaps your script in this case would parse the instances that are currently active in the ELB, and then iterate through each, taking them out of the ELB, running the update (or whatever you need to do) and then putting them back before moving on to the next.

Bash script to automate adding and removing servers to an ELB

This bash script is dead simple. We are simply grabbing the instance id of the script its running on and then read the user input to determine if the request is to add or remove the instance in question from the ELB. The script can definitely be improved further to perhaps include an error checker to make sure if you are removing the instance that there is at least 1 other active instance in the ELB before doing that (to avoid outages).

#!/bin/sh

#check command input
if [ -z "$  1" ];
then
        echo "STACKSTAR ELB MANIPULATION"
        echo "--------------------------"
        echo ""
        echo "Usage : ./elbstack add"
        echo "Usage : ./elbstack remove"
        echo ""
        exit 0
fi

current_instance=`/usr/bin/wget -q -O - http://instance-data/latest/meta-data/instance-id`

if [ "$  1" -eq "add" ];
then
        echo "Removing $  current_instance..."
        /usr/bin/aws elb register-instances-with-load-balancer --load-balancer-name your-elb-name --instances $  current_instance
elif [ "$  1" -eq "remove" ];
then
        echo "Removing $  current_instance..."
        /usr/bin/aws elb deregister-instances-from-load-balancer --load-balancer-name your-elb-name --instances $  current_instance
else
        echo "Invalid command argument given."
fi

Pretty straightforward! Again, better error checking and perhaps parsing the output of the aws commands may add better checks and balances to this kind of manipulation of your ELBs. For that level of checking and parsing it might be worth exploring using Python instead of Bash.

The post Use AWS CLI to automate the removal and addition of instances in your ELB appeared first on Managed WordPress Hosting | Managed VPS Hosting | Stack Star.

Managed WordPress Hosting | Managed VPS Hosting | Stack Star

Linux Cpanel shared hosting: 600 GB disk space, 6 TB bandwidth, free domain, unlimited databases and ftp accounts, web hosting cheap and pro at Hostony

4 Steps to Automate Twitter Relationship Building in 15 Minutes

Posted by: Admin  :  Category: Web Hosting

This is a guest post by Jon Cooper from Point Blank SEO.

Building relationships is at the heart of link building, because people are the ones giving links, not websites. The newest and hottest way to build relationships in your niche is to engage with them on social media, but we all know how time consuming this can be. Take, for example, twitter. Although an awesome tool to use to talk to influential people in your niche, the hours you spend each day pile up over time.

I recently just started doing SEO for a client who didn’t have a company twitter account, so I had to start from scratch. I didn’t want to spend much time on twitter, but at the same time I wanted to yield it for all it’s worth. Here’s a simple 4-step guide to automating your twitter account to tweet about the things you want, and the best part about it is that it won’t take you more than 15 minutes! Over time, the people/companies in your niche will take notice of your tweets, and this can be the first step to connecting personally with each of them.

1) Identify influential bloggers – they don’t necessarily have to be the cream of the crop in your niche, but rather just the ones you want to start building relationships with. Once you identify them, make a list of all of their RSS feeds in a simple text document.

2) Use Google Alerts – if you’ve never used Google Alerts before, it’s a tool to help you monitor the Web for any keyword or phrase of your choosing. For example, if I wanted to know whenever the phrase “link building contest” was mentioned, I could sign up for a daily Google Alert & get it sent to my email or by RSS feed. In this case, set up a couple alerts and have them be created as RSS feeds. Make sure you add these RSS feeds to your text document list.

3) Combine the feeds – By using RSS Mix, you’re able to combine any number of RSS feeds into just one. This will bypass some of the fees you would have had to pay in the next step.

4) Use Hootsuite to tweet the RSSHootsuite is an awesome tool to stay on top of twitter, and luckily for us it’s free to use. Sign up for an account, sync your twitter account, and then add an RSS feed to your account. The RSS feed you’re adding is the combined one we created in step 3. Set it up so each new item is tweeted via your twitter account.

The reason we combined the feeds in step 3 is because Hootsuite’s free plan allows only 2 RSS feeds, so if you wanted to use all of the ones individually through it, you would have to pay $ 6/month.

I don’t recommend this as a full time option for your twitter account, but rather as a great way to get started. By tweeting about the most relevant content in your niche, you have a great chance as being one of the twitter authorities. Also, make sure you’re tweeting about your own content too, whether it’s adding your feed to the mega feed we created in Step 3 or if you’re doing it manually.

If you’d like to keep up to date with the latest news & content on link building and relationship building, add Point Blank SEO to your circles, or follow me on twitter.

Thanks for reading! Be sure to leave any feedback below; I’m dying to hear what you have to say!

Related posts:

  • No Related Post

Web Hosting Geeks’ Blog – News, Trends, Discussions.

Reasons for ASP.Net programming technology to automate your business processes select

Posted by: Admin  :  Category: Web Hosting

reasons for ASP.Net programming technology to automate your business processes select

In today’s fast moving and competitive edge Internet it is really hard to survive for your business. If you plan on only domestic destination and want to market your product even though direct marketing may only be really hard, or we can say that you do not survive. For high profile product and business web presence is important, but if your product is not as high profile then you must also online presence. To develop a website for your business is one of the best ways to have a web presence. To develop a site-programming is required. increase

site, not just to reduce resources and the speed and accuracy of automation required. For the automation program to a system is fundamental. Now the question is there are so many technologies and programming languages. If you are a non-technical person carrying a big question for you is that the technology is the best choice. Do not worry, we are here to help you. ASP.Net Under the current scenario is the best technology to go with.

ASP stands for Active Server Pages. ASP.Net Programming is very useful to develop dynamic pages. The . NET development is widely used, the solutions, as businesses and all other types of web sites, business to business portal development business to customer portal, CRM systems, e-commerce sites, auction sites and systems, Poll and websites and systems, etc. ASP.Net Programming is very user friendly and easy to deploy . NET programmers . Sun dot net programming is widely used to develop all software development application.

Today, every company has its own requirements. If someone wants to build a website or system for the exercise of their professional development, he or she has their own requirements. As individual as a part of the programming is to buy. If the system has developed in ASP.Net Programming technology, the individual be very simple. This is one of the great advantages of ASP programming . NET .

Another reason for using dot net programming you will find the ASP.Net Programmer very easily. India is the country where so many asp programmer can find. It is simply a . NET programmers to find India . So many companies offer software development and web development in India. For renting one. NET programmers form India is a wise decision. The main reasons are Indian Website Programming industry, with more than 10 years experience in software development. The programmers from India are working with ASP.Net the time of its introduction. So if any problems after the development of a system Indian programmers come can solve it. Another advantage is the ability to communicate. Asp Indian programmers are very good communication skills, so as to convey the idea is very simple. The price is always the most important factor. Here you will find a quality and accurate ASP.Net Programmer at a very affordable price.

So just go online and automate your business by asp.net programming with the setting and ASP.Net programmers from India. You are not in a position, a good web development company find , you can also a freelance programmer from India very easily. To create your online presence and automate your business processes with ASP.Net Technology .

Related Asp Programming Article

Web Hosting Blog

Cron Job Tutorial: Automate the Email Sending for Newsletter

Posted by: Admin  :  Category: Web Hosting Tutorials

Learn about cron jobs. Automate the Email Sending for Newsletter. We are demonstrating using Godaddy here.
Video Rating: 4 / 5