AWS Lightsail default ssh userid

To ssh into AWS ec2 instances the default user id is usually ‘ec2-user’ (see my ec2 ssh checklist here).

Lightsail vps instances appear to use different default userids, depending on the OS. For example, for an Ubuntu Lightsail instance the default ssh userid is ‘ubuntu’:

ssh -i path-to-your-ssh-pen-file ubuntu@your-instance-ip

Mount as EBS volume inside a EC2 instance

By default, if you provision and attach additional EBS volumes for an EC2 instance, they don’t get mounted by default.

The boot EBS is usually /dev/xvda1. Each additional EBS volume should be /dev/xvdb and so on.

First format the new volume:

sudo mkfs -t ext4 /dev/xvdb

Make a mount mount directory like /data, then mount it with:

sudo mount /dev/xvdb /data

Now you should see the new volume available:

$ df -h
Filesystem      Size  Used Avail Use% Mounted on
devtmpfs        3.9G     0  3.9G   0% /dev
tmpfs           3.9G     0  3.9G   0% /dev/shm
tmpfs           3.9G  432K  3.9G   1% /run
tmpfs           3.9G     0  3.9G   0% /sys/fs/cgroup
/dev/xvda1       20G  8.8G   12G  44% /
tmpfs           798M     0  798M   0% /run/user/1000
/dev/xvdb       7.8G   36M  7.3G   1% /data

Add a line to /etc/fstab to mount on startup:

/dev/xvdb /data ext4 defaults,nofail 0 2

These steps are from multiple places, mainly answers to this question.

Installing Oracle Instant Client and Tools in an AWS EC2

I’m using the AWS Amazon Linux 2 AMI on my EC2. To download the Oracle Instant Client get the download urls for the instant client and instant client tools from: https://www.oracle.com/database/technologies/instant-client/linux-x86-64-downloads.html

Download using curl and install with rpm:

curl instant-client-url-from-page-above --output instant-client.rpm
rpm -i instant-client.rpm
curl instant-client-tools-from-page-above --output instant-client-tools.rpm
rpm -i instant-client-tools.rpm

To connect using sql-plus:

sqlplus 'admin@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=your-instance-endpoint.rds.amazonaws.com)(PORT=1521))(CONNECT_DATA=(SID=your-db-name)))'

Enter password when prompted.