Solved: How to change hostname in AWS EC2 instance of RHEL 7

In our last post we have seen how to change hostname of an RHEL server.
But if you are using the RHEL 7 AMI provided on AWS marketplace the steps will be slightly different.
First login to your EC2 instance. (Check this post to know How to login to AWS EC2 Linux instance.)
Once you login to your EC2 instance execute below command.
 sudo hostnamectl set-hostname --static cloudvedas
(Here “cloudvedas” is the new hostname.)
If you want to make it persistent across reboot follow further.
Now using vi or vim editor edit the file /etc/cloud/cloud.cfg
sudo vi /etc/cloud/cloud.cfg
At the end of file add the following line and save the file
preserve_hostname: true
Finally reboot the server
sudo reboot
Once the server is up, check the hostname.
ec2-user# hostname
cloudvedas
ec2-user#
It should now show you the new hostname.

Solved: How to change hostname in Redhat Linux

In this post we will see how to change hostname in Redhat Linux 4, 5, 6 and 7 .
For changing the hostname you should have root access. To switch to root do:-
sudo su -
If you want to change the hostname temporarily do as below:-
hostname <new-hostname>
e.g.
hostname cloudvedas
But above change is not permanent and will change back to old name after reboot.
To make the change permanent you will have to make the entry in couple of files. If you are using RHEL 4,5,6 use the below steps, else directly go down to section for RHEL 7. If you don’t want to modify files manually refer this post to change hostname using nmtui or nmcli tools.
RedHat based system use the file /etc/sysconfig/network to read the saved hostname at system boot.
NETWORKING=yes
HOSTNAME=cloudvedas
Next you have to modify /etc/hosts file. Entry in hosts file should look like.
172.25.31.65 cloudvedas
RHEL 7
If you are having RHEL 7 you just have to execute one command which will take care of everything.
hostnamectl set-hostname --static cloudvedas
The above steps will make the hostname change persistent across reboot.
If you want, try to reboot the server with command “reboot” .
Once the server is up, check the hostname.
root# hostname
cloudvedas
root#
It should now show you the new hostname.
If you are using RHEL AMI from AWS marketplace the steps will be slightly different. For that refer our other post How to change hostname in AWS EC2 instance of RHEL 7 .

Solved: How to change the IAM role in Redshift cluster

In our last post we checked How to create a Redshift Cluster?
In this post we will see how to change the IAM role assigned to Redshift cluster.(Check earlier post to know how to create an IAM role.)
Note: Be careful to test the new role first in dev. Don’t try this in prod directly.
  • First create a role as per your requirement.
  • Next login to Redshift Console . Do check you are in correct region.
  • Select the Cluster by clicking on check box.
  • On the top you will see an option of “Manage IAM Roles”.  Click on that.
  • Select the role you created recently from the drop down and click “Apply Changes”
  • It will take 3-5 minutes to reflect the changes.

Solved: How to reset the Master User Password of Redshift Cluster

In our last post we checked How to create a Redshift Cluster?
At times you may want to reset the password of the master user in DB of Redshift.
In this post we will see how to reset the password of  master user in Redshift cluster.
Note:- Ensure that you really want to change the password.  Changing the password in production can break apps which may have old password stored anywhere.
  • Go to Redshift console and click on cluster for which you want to reset the password. In our case it was “testdw” .
  • Once you are inside the cluster configuration click on the “Cluster” drop down and select “Modify”.
  • You will see the field “Master user password”.  Enter the new password in it.
  • Finally click “Modify” .
This will change the master user password. Try connecting to the cluster with the new password.

Install vagrant and create VM on your windows laptop or desktop

In this post we will show you how to install vagrant in your laptop and start a Ubuntu Linux VM.
You will have to download these softwares and install them on your laptop.
  • Once they are downloaded.
First Install Virtual Box.  Just click on exe and follow installation instructions.
Next Install Vagrant. Just click on exe and follow installation instructions.
Putty and PuttyGen don’t need any installation, you can use them directly.
Once the pre-requisites are installed let’s move ahead.
  • Open the windows command prompt. CMD
  • Go to the directory where you will need the vagrant machines to be installed. e.g.
cd C:\users
  • Once you are in desired directory create a new directory .
mkdir ProjectVagrantcd ProjectVagrant
  • Create a new Vagrant File
vagrant init ubuntu/trusty64
  • Below command will download the Ubuntu Trusty 64 OS image and create VM. Ensure you are connected to network.
vagrant up
  • Setup ssh
vagrant ssh
Above command will give you IP, Port and Private key for the machine.
  • Using putty you can connect to the machine. Add entries like below.
Hostname:- vagrant@127.0.0.1
Port :- 2222
Default password :- vagrant


If you want to login using the ssh key you will have to first convert the .pem key to .ppk. Follow this post on How to convert .pem key to .ppk and login to VM ?
That’s all in this post! Hope it’s useful for you. If you have any query please write in comments section.