Solved: How to change from EFI to SMI label and vice-versa

Hello!
In this post we will see how to change the disk label from EFI to SMI in a Solaris server.
Before you decide to change the disk label ensure that the disk doesn't have any important data. If needed take backup of the disk. As during label change all the data will be removed from the disk.
We will use "format -e" command to change the label on disk.
root@cldvds# format -e c0t6006023764A62A00C5H174886B5BC267d0

format> la
 [0] SMI Label
 [1] EFI Label
 Specify Label type[1]: 0
 Auto configuration via format.dat[no]?
 Auto configuration via generic SCSI-2[no]?

Geometry: 256 heads, 10 sectors 40960 cylinders result in 104857600 out of 104857600 blocks.
 Do you want to modify the device geometry[no]? yes
 format> p
The disk partition should now change from 0 to 9 slices(EFI) to 0 to 7 slices (SMI).
If you want to change from SMI to EFI you can follow the same steps and instead of choosing option 0 choose option 1.
That's all folks! Do comment if you have any concern or query!

Solved: Create virtual environment with python 3 in linux

Once you have installed python 3.6 as described in the last post you can create virtual environment to work with it.
  • First let’s install the package of virtual environment for python 3.
CentOS/RHEL
sudo yum install -y python3-venv
Ubuntu
sudo apt-get install -y python3-venv 
  • Create a directory for you virtual environment and get inside it.
mkdir virtualenvscd virtualenvs
  • Now let’s create our virtual environment.
python3.6 -m venv cloudvedasenv
  • Finally activate the new virtual environment. Notice the new environment name in brackets once you run the source command. That means you are now inside the virtual environment.
[ec2-user@cloudvedas ~]$ source cloudvedasenv/bin/activate
(cloudvedasenv) [ec2-user@cloudvedas ~]$
  • If you want to install a package inside the virtual environment you can use pip .
(cloudvedasenv) [ec2-user@cloudvedas ~]$ pip install zappa requests flask

How to prepare for AWS Certified Developer - Associate certificationexam

In one of our earlier post we have detailed about which AWS certification is suitable for you ?
If you have decided to go for AWS Certified Developer – Associate certification this post is for you.
If you are  an absolute beginner you can start with free labs from AWS . To practice further you can create free AWS account. These two actions will get you started on AWS.
Beware that if you go beyond free tier limits you will be billed. Best practice is to create a billing alert.  This alert can save you from unexpected bill shockers.
To further hone your skills you can either go for AWS classroom training or go for online courses. The classroom training will cost you from USD 800 to USD 2000. While the online courses can cost you from USD 10 to USD 300, depending on which course you choose.
Our personal opinion is that you should go for online courses as they are cheaper and if you follow their labs honestly they can be as good as classroom training.
In online courses we recommend two providers acloudguru and Linux Academy.  Both have monthly plans to buy the courses but they can become bit costly if you can’t complete the course in 1 month.
We have observed that acloudguru also provide the same course on Udemy where you get lifetime access to course with just one time payment. Also, Udemy provide heavy discounts on courses during sale which can get you a good bargain.
Thus, we recommend this AWS Certified Developer – Associate course  of acloudguru on Udemy . Also, once you buy this course on Udemy you will get access of the same course on acloudguru website also.
The acloudguru course instructor Ryan is an industry expert and deliver the course really well. The course will cover almost all the main topics which are asked in exam.  (Though we have observed that as of Apr-18 it was missing a session on AWS lambda for which the questions have started appearing in exam. Hope they update the course soon.) Currently you can learn about lambda from Ryan’s other course on AWS Lambda .
It’s a good idea to follow all the labs with the instructor and once you get confidence redo the labs independently. Don’t forget to complete the practice quizzes to check your knowledge.
This course will give you good base for the exam. But, the course itself is not enough to clear the exam.  You should go through whitepapers and FAQs of atleast below service .
  • EC2
  • S3
  • SQS
  • RDS
  • DynamoDB
  • Lambda
Exam pattern
Exam has Multiple-choice and multiple-answer questions. Exam is of 80 minutes.
Practice Exam Questions
To get a good evaluation of your preparation you can go through another course of  acloudguru sample exam questions on Udemy  .  Many test takers have said that they got similar questions in exam.
Exam Cost
Exam will cost you USD 150. AWS also gives you an option to book a practice exam for USD 20 before you go for actual exam.
How to book exam
To book an exam you will have to create an account in AWS Training and Certification Portal .
Passing score
AWS doesn’t reveal minimum passing score and it keeps on changing. But we have observed that generally people who score above 80% passed the exam. You will immediately see the score on you screen once you finish the test and will also get a report on your mail within 1 hour.
Exam Tips
  • Get good sleep and keep calm during the exam.
  • You won’t get more than 3 mins per question.
  • You may find some very long questions in exam. Best strategy to tackle them is to read the answer options first and than check for relevant info in question.
  • Since it’s an AWS exam so look for AWS related options in the answers.  Chances are high that  Non-AWS related option in answer will be wrong.
  • AWS exams generally don’t focus on mugging their datasheets. So you won’t get a question like “How much RAM does a C3.xlarge offer?” .
That’s all folks! Best of luck for the exam!
Do let us know in comments section if you have any query.

Solved: Restore root disk of EC2 without changing IP or Hostname

If the root volume of your EC2 instance got corrupt, instance won’t come up. Since you don’t have access to console of EC2 instance so you can’t do much.
In this post we will discuss options to restore an EC2 instance from snapshot backup. Prerequisite for the below guide is that you already have snapshot of the volume which you want to restore.
Option 1 – Different IP and Hostname 
Easiest option to restore an EC2 instance is to launch a new instance with the available snapshot. Refer this AWS doc to launch an instance from backup.
But, an instance launched this way will have both hostname and private IP different from original instance. If this is a problem for you go to option 2.
Option 2 – Same IP different Hostname
So, as per option 1 you have created and instance with an AMI but now you need the IP to be same as old one. To go around this you can detach the network interface of old instance and attach it to new instance.
This option will give you same private IP as old one but you will still have new hostname.
If you need both hostname and IP to be same go to option 3.
Option 3 – Same IP and Hostname
In this option we will discuss how you can restore an EC2 instance and keep both hostname and IP same. This can very important if your EC2 instance is in Active Directory(AD) domain, as change in IP and hostname mapping will cause conflict in domain. Because of this conflict the domain server can block login to the EC2 instance.
Let’s see how we can get around this.
Prerequisites:-
  • You already have snapshot of the root and other volumes of instance.
  • Keep a screenshot of your Instance description from your AWS console, this can be used to refer instance configuration later.
Plan
For the eager one’s, plan is to follow the below steps.
  • Stop the instance
  • Detach the current root EBS
  • Create a new volume from the old snapshot
  • Attach the new volume to instance
  • Boot the instance
Now let’s see the steps in detail.
Stop Instance
Stop the instance if it’s up.
Detach the current root EBS 
  • Select the root volume(/dev/sda1) mentioned as “Root device” from instance description and click on EBS id of the volume.
  • You will now come in “Volumes” window.
  • From the “Actions” drop down select “Detach Volume”
Create a new volume from the old snapshot
  • Create a volume from the snapshot you have taken earlier.
  • Select the snapshot of the volume and from “Actions” drop down select “Create Volume”.
  • In the “Create Volume” window ensure that you select the Availability Zone to be same as the AZ in which your instance is located.
  • Leave the other options as default. 
  • Finally hit “Create Volume”.
Attach the new volume
  • Once your volume is created select it.
  • From the “Actions” drop down select “Attach”.
  • While attaching the volume in the device field mention volume name as /dev/sda1 since we are attaching it as root volume. This is same as your old root volume name.
  • Hit “Attach” .
Boot instance
  • Once the volume is attached start the instance normally. You should now see that the instance has the data from your old backup. Also, it’s hostname and private IP will remain same as before.
Note:- If you want to keep the public IP to be fixed, you need to assign an Elastic IP to the instance. Public IP assigned by default, by AWS keeps on changing with every reboot.
That’s all folks!

Solved: Install Python 3 in Linux and set it as default

In this post we will show you how to install python 3 in a Linux box. We have Centos 7 installed in our server.
Check installed python version
Most of the Linux versions by default have python installed. So let's check the current version.
[ec2-user@cloudvedas ~]$ python --version
 Python 2.7.5
[ec2-user@cloudvedas ~]$
As we can see from the above output, currently we have Python 2 installed and we need Python 3 so let's install it.
Install pre-requisites
Before we install python 3 let's first update the yum.
[ec2-user@cloudvedas ~]$ sudo yum -y update
Also, install yum utils.
[ec2-user@cloudvedas ~]$ sudo yum -y install yum-utils
And at the end install the CentOS development tools which will help you build and compile software from source code.
[ec2-user@cloudvedas ~]$ sudo yum -y groupinstall development
Install python 3.6.4
The standard yum repos does not have the latest python release, so we will install IUM (Inline with Upstream Stable) which will have the latest packages.
[ec2-user@cloudvedas ~]$ sudo yum -y install https://centos7.iuscommunity.org/ius-release.rpm
Now let's install Python 3.6.
[ec2-user@cloudvedas ~]$ sudo yum -y install python36u
Next we will install pip, which will manage software packages for Python:
[ec2-user@cloudvedas ~]$ sudo yum -y install python36u-pip
Finally, we will install the development packages.
[ec2-user@cloudvedas ~]$ sudo yum -y install python36u-devel
Let' check our  python version
[ec2-user@cloudvedas ~]$ python3.6 -V
Python 3.6.4
[ec2-user@cloudvedas ~]$
Update default python
But if you still run the normal command to check python version it will show the Python 2 version if it was installed by default.
[ec2-user@cloudvedas ~]$ python --version
 Python 2.7.5
 [ec2-user@cloudvedas ~]$
To reflect the new python version by default you create an alias in .bashrc file as described below in the last line of the file.
[ec2-user@cloudvedas ~]$ sudo vi ~/.bashrc

# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then . /etc/bashrc fi
# Uncomment the following line if you don't like systemctl's auto-paging feature:
# export SYSTEMD_PAGER=
# User specific aliases and functions
alias python=python3.6
After making the changes save the file. Now, logout and login again, it should show you the new version.
[ec2-user@cloudvedas ~]$ python -V
Python 3.6.4
[ec2-user@cloudvedas ~]$
Check all installed python versions
Do remember that the default python 2 will still remain in the system as lot of system binaries have dependency on it.
To check all the python versions in your box you can check the installed packages as below.
[ec2-user@cloudvedas ~]$ yum list installed | grep -i python
If you want to create virtual environments in python read our next post.