Amazon Lightsail is an Amazon cloud service that offers bundles of cloud compute power and memory for new or less experienced cloud users. Amazon Web Services (AWS) packages memory, processing, storage and transfer into virtual machines (VMs) for customers to purchase, and then releases that compute capacity as Amazon Elastic Compute Cloud (EC2) instances. Amazon Lightsail derives its compute power from an EC2 instance and repackages it for customers.

1 Amazon Lightsail: Setting up a instance

To create your Amazon Lightsail server, first, sign in to your AWS account and click Create instance.

The first step should be the choice of the location of the instance in the regions available by Amazon.

Because ours instances will only install on a clean server with no existing web stack or applications, click Base OS to pick your instance image. Then, click Because Amazon Linux (Amazon has their own Linux distribution based on Red Hat Enterprise Linux).

Lightsail will generate a default SSH key pair or you can decide to use your own.

Now, choose your instance plan. Amazon Lightsail's five plans as well as its pricing model are closed but once created it offers multiple possibilities of configuration change. All Lightsail plans include a static IP address, a management console, secure shell terminal access and key management, domain name server management, and server monitoring. Lightsail customers also have access to AWS tools.

We must also assign a name to the instance.

It takes less than a minute to provision the server. Clicking on the three vertical dots on the instance resource will open a menu from where we can stop, restart, delete, connect to, or manage the instance.

2 Management to instance.

Selecting Manage from the menu or clicking on the instance name in the dashboard will take us to a different screen:

From here you can select the different options that provide us to manage the instance.

2.1 Connection.

There are two options for connecting to the console.

2.1.1 Browser

The connect option from browser will open a new window with SSH access, as shown below:

This connects us as user "ec2-user". User created by default. The access as root user will be through "sudo su".

2.1.2 Connect instance using SSH

For ssh remote access to the instance we must use the key-pair generated by default or generate new ones. Must be logged in the AWS Console page.

To download or generate a valid pair of keys (.pem file) you must access from any instance, selecting Manage and the botton page click on Account page

Click on the download button of the correct region

1. Store .pem file download into user $HOME/.ssh

2. Use the chmod command to make sure that your private key file isn't publicly viewable. For example, if the name of your private key file is my-key-pair.pem, use the following command:

Copy
chmod 400 /path/my-key-pair.pem

3. Use the ssh command to connect to the instance. You specify the private key (.pem) file and user_name@public_dns_name. For example, if you used an Amazon Linux AMI, the user name is ec2-user.

Copy
ssh -i /path/my-key-pair.pem ec2-user@ec2-198-51-100-1.compute-1.amazonaws.com

You see a response like the following.

Copy
The authenticity of host 'ec2-198-51-100-1.compute-1.amazonaws.com (10.254.142.33)' can't be established.
RSA key fingerprint is 1f:51:ae:28:bf:89:e9:d8:1f:25:5d:37:2d:7d:b8:ca:9f:f5:f1:6f.
Are you sure you want to continue connecting (yes/no)?

4. Enter yes.

You see a response like the following.

Copy
Warning: Permanently added 'ec2-198-51-100-1.compute-1.amazonaws.com' (RSA) 
to the list of known hosts.

2.2 Storage.

With this option, we can attach additional storage to our instance.

For this click Create New Disk+. Then screen change, we must choice a size and to inform the name it and click on Create.

After a few minutes we will have the space available. Observe the name you have assigned to the disk for later operating system configuration.

2.3 Metrics.

The performance metrics for Lightsail instances are the same as those available for EC2, only fewer in number. As with CloudWatch metrics, these are available for up to two weeks. The metrics include:

  • CPU Utilization (%)
  • NetworkIn (incoming bytes received by all network interfaces)
  • NetworkOut (outgoing bytes sent by all network interfaces)
  • StausCheckFailed_Instance (if the instance VM itself failed AWS connectivity tests)
  • StatusCheckFailed_System (if the host containing the instance has a failure)
  • StatsuCheckFailed (a combination of StausCheckFailed_Instance and StatusCheckFailed_System)

2.4 Networking.

From here, you can check the public and private IP addresses of the instance. As with EC2, rebooting the instance will assign it a new public IP.

2.4.1 Create a static IP

There are instances that will require a fixed public IP. To do this, you can assign a static IP address to the instance. This will keep the ip fixed after a restart of the instance.

2.4.2 Change Firewall Configuration

Amazon Lightsail only opens ports 22 and 80 by default, so to use other ports on your new server, if for example you will need to open port 8080.

Once your server has fully booted, open your server's menu again and select Manage.

Then, navigate to the Networking tab.

Here you'll see the default firewall rules. Click +Add another.

Now, select HTTPS from the new rule's drop-down list and click Save.

2.5 Snapshots.

For virtual servers, snapshots are like a "point in time" copy of the entire instance. This is a common feature in all virtual server environments and Lightsail is no exception. Users can create snapshots of their Lightsail instance from this tab. Snapshots are available even after an instance has been terminated, so you can also recreate the instance later. The Snapshots tab lists the last five snapshots of the instance.

Choose Create Snapshot from the snapshot menu.

2.6 History.

This displays all of the events associated with the Lightsail instance. The image below shows five events: the instance was created, it was assigned a static IP address, and then a snapshot was made. After that, the instance was stopped and started:

2.7 Delete.

This tab allows you to delete the instance.

3 Change hostname to instance.

If you have a public DNS name registered for the IP address of your instance (such as webserver.mydomain.com), you can set the system hostname so your instance identifies itself as a part of that domain. This also changes the shell prompt so that it displays the first portion of this name instead of the hostname supplied by AWS (for example, ip-12-34-56-78). If you do not have a public DNS name registered, you can still change the hostname, but the process is a little different.

To change the system hostname to a public DNS name

Follow this procedure if you already have a public DNS name registered.

1. On your instance, open the /etc/sysconfig/network configuration file in your favorite text editor and change the HOSTNAME entry to reflect the fully qualified domain name (such as webserver.mydomain.com).

Copy
HOSTNAME=webserver.mydomain.com

2. Reboot the instance to pick up the new hostname.

Copy
[ec2-user ~]$ sudo reboot

3. Log into your instance and verify that the hostname has been updated. Your prompt should show the new hostname (up to the first ".") and the hostname command should show the fully-qualified domain name.

Copy
[ec2-user@webserver ~]$ hostname
webserver.mydomain.com

To change the system hostname without a public DNS name

1. Open the /etc/sysconfig/network configuration file in your favorite text editor and change the HOSTNAME entry to reflect the desired system hostname (such as >webserver).

Copy
HOSTNAME=webserver.localdomain

2. Open the /etc/hosts file in your favorite text editor and change the entry beginning with 127.0.0.1 to match the example below, substituting your own hostname.

Copy
127.0.0.1 webserver.localdomain webserver localhost4 localhost4.localdomain4

3. Reboot the instance to pick up the new hostname.

Copy
[ec2-user ~]$ sudo reboot

Alternatively, you can reboot using the Amazon EC2/Lightsail console (on the Instances page, choose Actions, Instance State, Reboot).

4. Log into your instance and verify that the hostname has been updated. Your prompt should show the new hostname (up to the first ".") and the hostname command should show the fully-qualified domain name.

Copy
[ec2-user@webserver ~]$ hostname
webserver.localdomain

4 Change Lightsail plan

After you create a snapshot in Lightsail, you can create a new instance from that snapshot. The new instance will include the system disk and any attached block storage disks you added.

1. On the home page, choose the instance you want to manage. Or choose Manage from the instance menu.

2. Choose Snapshots.

Important

When you create a new instance from a snapshot, Lightsail lets you create an instance bundle that is either the same size or larger size. We do not currently support creating a smaller instance size from a snapshot. The smaller options will be grayed out when you create a new instance from a snapshot.

3. Choose Create new instance from the snapshot menu.

4. On the Create an instance from a snapshot page, you have a few optional settings to decide on at the top. For example, you can change the Availability Zone, add a launch script, or change the way you connect to your instance.

You can accept all the defaults and move on to the next step.

5. Choose the plan (or bundle) for your new instance. At this point, you can choose to create a larger bundle size if you'd like.

Give your instance and disks new, unique names, and then choose Create.