Build EC2 RHEL Client Box for Development

In this post I’ll describe creating an EC2 RHEL 8.0 client instance that will be used for accessing and administering various DB instances in AWS.

I’ll start with instantiating a t2.medium sized instance in us-east-2 region with default 10 GB root disk. Pricing is reasonable at $0.0464 per Hour. I used RHEL-8.0.0_HVM-20190618-x86_64-1-Hourly2-GP2 (ami-0520e698dd500b1d1) AMI for this instance.

I opened up the SSH TCP in security group for port 22 to laptop, so that I can SSH into the machine. All other clusters and instances will be accessible only from this box. This box is bare RHEL 8.0 linux environment.

$ ssh -i Downloads/tspawskeyohio.pem  ec2-user@ec2-52-14-129-121.us-east-2.compute.amazonaws.com
Last login: Tue Aug 13 20:01:04 2019 from 73.187.197.50
[ec2-user@ip-172-31-14-142 ~]$ ll /
total 16
lrwxrwxrwx.   1 root root    7 Aug 12  2018 bin -> usr/bin
dr-xr-xr-x.   6 root root 4096 Aug 13 19:55 boot
drwxr-xr-x.   2 root root    6 Jun 18 17:10 data
drwxr-xr-x.  18 root root 2720 Aug 13 19:53 dev
drwxr-xr-x.  80 root root 8192 Aug 13 19:54 etc
drwxr-xr-x.   3 root root   22 Aug 13 19:54 home
lrwxrwxrwx.   1 root root    7 Aug 12  2018 lib -> usr/lib
lrwxrwxrwx.   1 root root    9 Aug 12  2018 lib64 -> usr/lib64
drwxr-xr-x.   2 root root    6 Aug 12  2018 media
drwxr-xr-x.   2 root root    6 Aug 12  2018 mnt
drwxr-xr-x.   2 root root    6 Aug 12  2018 opt
dr-xr-xr-x. 104 root root    0 Aug 13 19:53 proc
dr-xr-x---.   3 root root  170 Aug 13 20:28 root
drwxr-xr-x.  23 root root  660 Aug 13 19:54 run
lrwxrwxrwx.   1 root root    8 Aug 12  2018 sbin -> usr/sbin
drwxr-xr-x.   2 root root    6 Aug 12  2018 srv
dr-xr-xr-x.  13 root root    0 Aug 13 19:53 sys
drwxrwxrwt.   8 root root  172 Aug 13 21:07 tmp
drwxr-xr-x.  12 root root  144 Jun 18 17:04 usr
drwxr-xr-x.  20 root root  278 Aug 13 19:53 var
[ec2-user@ip-172-31-14-142 ~]$

Now I’ll install python 3.7, AWS CLI, Vertica SQL client (VSQL), Boto3 library and other python modules.

Install Python 3

sudha@DESKTOP-61047H4 MINGW64 ~
$ ssh -i Downloads/tspawskeyohio.pem  ec2-user@ec2-52-14-129-121.us-east-2.compute.amazonaws.com
Last login: Tue Aug 13 21:21:01 2019 from 73.187.197.50
[ec2-user@ip-172-31-14-142 ~]$ sudo su -
Last login: Tue Aug 13 21:44:50 UTC 2019 on pts/0
[root@ip-172-31-14-142 ~]# yum install python3
Red Hat Update Infrastructure 3 Client Configuration Server 8  
. . . SNIP SNIP . . .
Installed:
  python36-3.6.8-2.module+el8.0.0+2975+e0f02136.x86_64                                                     python3-pip-9.0.3-13.el8.noarch

Complete!
[root@ip-172-31-14-142 ~]# python3
Python 3.6.8 (default, Apr  3 2019, 17:26:03)
[GCC 8.2.1 20180905 (Red Hat 8.2.1-3)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> quit()
[root@ip-172-31-14-142 ~]#

Install pip3

[root@ip-172-31-14-142 ~]# dnf install python3-pip
Last metadata expiration check: 0:06:23 ago on Tue 13 Aug 2019 09:45:34 PM UTC.
Package python3-pip-9.0.3-13.el8.noarch is already installed.
Dependencies resolved.
Nothing to do.
Complete!
[root@ip-172-31-14-142 ~]#

Install a python3 module using pip3

[root@ip-172-31-14-142 ~]# python3
Python 3.6.8 (default, Apr  3 2019, 17:26:03)
[GCC 8.2.1 20180905 (Red Hat 8.2.1-3)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
Traceback (most recent call last):
  File "<stdin&gt;", line 1, in <module&gt;
ModuleNotFoundError: No module named 'numpy'
&gt;&gt;&gt; quit()
[root@ip-172-31-14-142 ~]# pip3 install numpy
WARNING: Running pip install with root privileges is generally not a good idea. Try `pip3 install --user` instead.
Collecting numpy
  Downloading https://files.pythonhosted.org/packages/19/b9/bda9781f0a74b90ebd2e046fde1196182900bd4a8e1ea503d3ffebc50e7c/numpy-1.17.0-cp36-cp36m-manylinux1_x86_64.whl (20.4MB)
    100% |████████████████████████████████| 20.4MB 67kB/s
Installing collected packages: numpy
Successfully installed numpy-1.17.0
[root@ip-172-31-14-142 ~]# python3
Python 3.6.8 (default, Apr  3 2019, 17:26:03)
[GCC 8.2.1 20180905 (Red Hat 8.2.1-3)] on linux
Type "help", "copyright", "credits" or "license" for more information.
&gt;&gt;&gt; import numpy
&gt;&gt;&gt; quit()
[root@ip-172-31-14-142 ~]#

Install boto3 using pip3

[root@ip-172-31-14-142 ~]# pip3 install boto3
WARNING: Running pip install with root privileges is generally not a good idea. Try `pip3 install --user` instead.
Collecting boto3
  Downloading https://files.pythonhosted.org/packages/76/fb/3830e86db69775b1500d31d26d1dfcc83eada4af1627c14113168408431a/boto3-1.9.207-py2.py3-none-any.whl (128kB)
    100% |████████████████████████████████| 133kB 3.1MB/s
Collecting jmespath<1.0.0,&gt;=0.7.1 (from boto3)
  Downloading https://files.pythonhosted.org/packages/83/94/7179c3832a6d45b266ddb2aac329e101367fbdb11f425f13771d27f225bb/jmespath-0.9.4-py2.py3-none-any.whl
Collecting s3transfer<0.3.0,&gt;=0.2.0 (from boto3)
  Downloading https://files.pythonhosted.org/packages/16/8a/1fc3dba0c4923c2a76e1ff0d52b305c44606da63f718d14d3231e21c51b0/s3transfer-0.2.1-py2.py3-none-any.whl (70kB)
    100% |████████████████████████████████| 71kB 9.7MB/s
Collecting botocore<1.13.0,&gt;=1.12.207 (from boto3)
  Downloading https://files.pythonhosted.org/packages/86/09/4d366af788f4dc9289f55679e71259f9effde4c3b19a109347c2e54e9e82/botocore-1.12.207-py2.py3-none-any.whl (5.7MB)
    100% |████████████████████████████████| 5.7MB 245kB/s
Collecting docutils<0.15,&gt;=0.10 (from botocore<1.13.0,&gt;=1.12.207-&gt;boto3)
  Downloading https://files.pythonhosted.org/packages/36/fa/08e9e6e0e3cbd1d362c3bbee8d01d0aedb2155c4ac112b19ef3cae8eed8d/docutils-0.14-py3-none-any.whl (543kB)
    100% |████████████████████████████████| 552kB 2.5MB/s
Requirement already satisfied: urllib3<1.26,&gt;=1.20; python_version &gt;= "3.4" in /usr/lib/python3.6/site-packages (from botocore<1.13.0,&gt;=1.12.207-&gt;boto3)
Requirement already satisfied: python-dateutil<3.0.0,&gt;=2.1; python_version &gt;= "2.7" in /usr/lib/python3.6/site-packages (from botocore<1.13.0,&gt;=1.12.207-&gt;boto3)
Requirement already satisfied: six&gt;=1.5 in /usr/lib/python3.6/site-packages (from python-dateutil<3.0.0,&gt;=2.1; python_version &gt;= "2.7"-&gt;botocore<1.13.0,&gt;=1.12.207-&gt;boto3)
Installing collected packages: jmespath, docutils, botocore, s3transfer, boto3
Successfully installed boto3-1.9.207 botocore-1.12.207 docutils-0.14 jmespath-0.9.4 s3transfer-0.2.1
[root@ip-172-31-14-142 ~]#

Install AWS CLI

[root@ip-172-31-14-142 ~]# pip3 install awscli --upgrade
WARNING: Running pip install with root privileges is generally not a good idea. Try `pip3 install --user` instead.
Collecting awscli
  Downloading https://files.pythonhosted.org/packages/f2/80/f39d191f831202dd1e244ed00f714e490d1c2685c52dca1b3c1a49778eea/awscli-1.16.217-py2.py3-none-any.whl (1.9MB)
    100% |████████████████████████████████| 1.9MB 758kB/s
Collecting PyYAML<=5.1,&gt;=3.10; python_version != "2.6" (from awscli)
  Downloading https://files.pythonhosted.org/packages/9f/2c/9417b5c774792634834e730932745bc09a7d36754ca00acf1ccd1ac2594d/PyYAML-5.1.tar.gz (274kB)
    100% |████████████████████████████████| 276kB 3.1MB/s
Collecting colorama<=0.3.9,&gt;=0.2.5 (from awscli)
  Downloading https://files.pythonhosted.org/packages/db/c8/7dcf9dbcb22429512708fe3a547f8b6101c0d02137acbd892505aee57adf/colorama-0.3.9-py2.py3-none-any.whl
Collecting rsa<=3.5.0,&gt;=3.1.2 (from awscli)
  Downloading https://files.pythonhosted.org/packages/e1/ae/baedc9cb175552e95f3395c43055a6a5e125ae4d48a1d7a924baca83e92e/rsa-3.4.2-py2.py3-none-any.whl (46kB)
    100% |████████████████████████████████| 51kB 10.2MB/s
Requirement already up-to-date: botocore==1.12.207 in /usr/local/lib/python3.6/site-packages (from awscli)
Requirement already up-to-date: docutils<0.15,&gt;=0.10 in /usr/local/lib/python3.6/site-packages (from awscli)
Requirement already up-to-date: s3transfer<0.3.0,&gt;=0.2.0 in /usr/local/lib/python3.6/site-packages (from awscli)
Collecting pyasn1&gt;=0.1.3 (from rsa<=3.5.0,&gt;=3.1.2-&gt;awscli)
  Downloading https://files.pythonhosted.org/packages/6a/6e/209351ec34b7d7807342e2bb6ff8a96eef1fd5dcac13bdbadf065c2bb55c/pyasn1-0.4.6-py2.py3-none-any.whl (75kB)
    100% |████████████████████████████████| 81kB 10.8MB/s
Collecting python-dateutil<3.0.0,&gt;=2.1; python_version &gt;= "2.7" (from botocore==1.12.207-&gt;awscli)
  Downloading https://files.pythonhosted.org/packages/41/17/c62faccbfbd163c7f57f3844689e3a78bae1f403648a6afb1d0866d87fbb/python_dateutil-2.8.0-py2.py3-none-any.whl (226kB)
    100% |████████████████████████████████| 235kB 2.7MB/s
Requirement already up-to-date: jmespath<1.0.0,&gt;=0.7.1 in /usr/local/lib/python3.6/site-packages (from botocore==1.12.207-&gt;awscli)
Collecting urllib3<1.26,&gt;=1.20; python_version &gt;= "3.4" (from botocore==1.12.207-&gt;awscli)
  Downloading https://files.pythonhosted.org/packages/e6/60/247f23a7121ae632d62811ba7f273d0e58972d75e58a94d329d51550a47d/urllib3-1.25.3-py2.py3-none-any.whl (150kB)
    100% |████████████████████████████████| 153kB 4.8MB/s
Collecting six&gt;=1.5 (from python-dateutil<3.0.0,&gt;=2.1; python_version &gt;= "2.7"-&gt;botocore==1.12.207-&gt;awscli)
  Downloading https://files.pythonhosted.org/packages/73/fb/00a976f728d0d1fecfe898238ce23f502a721c0ac0ecfedb80e0d88c64e9/six-1.12.0-py2.py3-none-any.whl
Installing collected packages: PyYAML, colorama, pyasn1, rsa, awscli, six, python-dateutil, urllib3
  Running setup.py install for PyYAML ... done
Successfully installed PyYAML-5.1 awscli-1.16.217 colorama-0.3.9 pyasn1-0.4.6 python-dateutil-2.8.0 rsa-3.4.2 six-1.12.0 urllib3-1.25.3
[root@ip-172-31-14-142 ~]#
[root@ip-172-31-14-142 ~]#
[root@ip-172-31-14-142 ~]# aws configure
AWS Access Key ID [None]:
AWS Secret Access Key [None]:
Default region name [None]:
Default output format [None]:
[root@ip-172-31-14-142 ~]#

Next post, I’ll create a some Vertica clusters and create AMI for them.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s