Clear Linux* OS on Amazon Web Services*

This tutorial explains how to create and launch a Clear Linux OS AMI instance from the AWS* console and complete the following tasks:

  1. Locate and select the Clear Linux OS OS Basic AMI in the AWS Marketplace.

  2. Create a new public and private key pair to allow you to connect to your Clear Linux OS instance securely.

  3. Launch the new Clear Linux OS instance and connect to it.

  4. Update your instance of Clear Linux OS using the swupd command.

  5. Stop the Clear Linux OS instance.

Prerequisites

This tutorial assumes the following statements are true:

  • You are using a linux-based system to access AWS and can run SSH to access the remote Clear Linux OS AWS image.

  • Your browser puts downloaded files in the $HOME/Downloads directory.

  • You have already set up an AWS user account and logged into the AWS console.

Note

This tutorial uses a Clear Linux OS AMI t2.micro instance that is eligible for the AWS free tier. To learn more about AWS and setting up an account, visit the AWS website at http://aws.amazon.com.

Locate, select, and launch the Clear Linux OS Basic AMI

  1. Start from your main AWS services console menu in your browser and select the EC2 text as shown in Figure 1:

    AWS Console

    Figure 1: AWS Console

    This selection brings up your EC2 Dashboard menu.

  2. To create a new Clear Linux OS instance from the EC2 Dashboard menu, select the Launch Instance button as shown in Figure 2:

    EC2 Dashboard

    Figure 2: EC2 Dashboard

    This selection takes you to the Step 1: Choose an Amazon Machine Image (AMI) menu.

  3. To find the Clear Linux OS Basic AMI in the Step 1: Choose an Amazon Machine Image (AMI) menu, do the following:

    1. In the lefthand navigation window, select the AWS Marketplace menu item to bring up the search bar to Search AWS Marketplace Products.

    2. In the search bar, type “clear linux os” and press the Enter key to search for and locate the Clear Linux OS Basic AMI.

    3. Select the Clear Linux OS Basic AMI by clicking the Select button as shown in Figure 3:

      Step 1: Choose AMI

      Figure 3: Step 1: Choose AMI

    4. A pop-up dialog box appears showing you more information about the Clear Linux OS Basic AMI along with the pricing details for running Clear Linux OS on different platform configurations as shown in Figure 4. Select the Continue button.

      Clear Linux OS Basic

      Figure 4: Clear Linux OS Basic

  4. The Choose Instance Type menu appears as shown in Figure 5.

    Choose an Instance Type

    Figure 5: Choose an Instance Type

    Select the t2.micro type by clicking the box on the left side of the instance and then select the Review and Launch button to move to the Step 7: Review the Instance Launch menu.

    Note

    You can configure the instance details, add additional storage, add tags, and configure the security group before selecting the Review and Launch button if you want to further customize this Clear Linux OS instance.

  5. The Step 7: Review the Instance Launch menu, shown in Figure 6, allows you to Cancel the process, return to the Previous screen to change the configuration or Launch the instance defined.

    Step 7: Review the Instance Launch

    Figure 6: Step 7: Review the Instance Launch

    1. Select the Launch button. A dialog box appears, as shown in Figure 7, asking you to Select an existing key pair or create a new pair.

      Select an existing key pair or create a new pair

      Figure 7: Select an existing key pair or create a new pair

      1. Select the Create a new key pair option.

      2. For the Key pair name field, enter AWSClearTestKey.

      3. Select the Download Key Pair button to download the AWSClearTestKey.pem to your browser’s defined Downloads directory.

      4. When the file finishes downloading, select the Launch Instances button to proceed to the Launch Status menu shown in Figure 8.

        Launch Status

        Figure 8: Launch Status

    2. Once the Launch Status page changes to what is shown in Figure 9, select the View Instances button to view your Instances dashboard.

      View Instance

      Figure 9: View Instance

Connect to your Clear Linux OS basic instance

Your Instances Dashboard is shown in Figure 10 with the new Clear Linux OS OS basic instance already selected and in the running state. If there are other instances available, they are also listed but not selected.

Instance Dashboard

Figure 10: Instance Dashboard

  1. To connect to your running instance, click the Connect button located at the top of your dashboard. AWS brings up the pop-up dialog box shown in Figure 11 describing how to connect to your running instance.

Connect to Your Instance

Figure 11: Connect to Your Instance

  1. Open a terminal on your system. You should be in your $HOME directory.

  2. Copy the previously downloaded keyfile from the Downloads directory to the current directory.

    cp Downloads/AWSClearTestKey.pem .
    
  3. Change the attributes of the AWSClearTestKey.pem using the chmod command as instructed in the dialog box shown in Figure 11.

    chmod 400 AWSClearTestKey.pem
    
  4. Copy the text highlighted in the Example: section that is shown in figure 11. Paste the copied text into your terminal, change the text before the @ sign to the username clear, and press the Enter key to execute the command.

    ssh -i "AWSClearTestKey.pem" clear@ec2-34-209-39-184.us-west-2.compute.amazonaws.com
    
  5. A message appears on the terminal stating the authenticity of the host can’t be established and prompts you with the message:

    The authenticity of host 'ec2-34-209-39-184.us-west-2.compute.amazonaws.com (34.209.39.184)' can't be established.
    ECDSA key fingerprint is SHA256:LrziT5Ar66iBTfia8qmiIsrfBUm/UGam76U8bDR6yJc.
    Are you sure you want to continue connecting (yes/no)?
    
  6. Type yes and press the Enter key. Another warning is printed to the terminal and you are now at the command prompt of your new Clear Linux OS instance.

    Warning: Permanently added 'ec2-34-209-39-184.us-west-2.compute.amazonaws.com,34.209.39.184' (ECDSA) to the list of known hosts.
    clear@clr-96a8565d0ca54b0c80364a1e5e7b0f88 ~ $
    

Update the Clear Linux OS instance

Run the sudo swupd update command to update the operating system as shown in Figure 12:

sudo swupd update

Figure 12: sudo swupd update

In this example, we updated from version 18940 to 19100.

Stop the Clear Linux OS instance

When you are finished using your AWS Clear Linux OS instance, you must stop it using the Instances dashboard to stop accruing charges. Complete the following steps from the Instances dashboard to stop your AWS Clear Linux OS instance from running.

  1. Select the Actions button to bring up a pull-down menu.

  2. Select the Instance State menu item to expand the options.

  3. Select Stop menu item to shut down the running instance.

    Figure 13 illustrates these steps.

    Stop Instance

    Figure 13: Stop Instance

  4. A pop-up dialog box appears warning you that any ephemeral storage of your instance will be lost. Select the Yes, Stop button to stop your Clear Linux OS instance.

Stop Instances

Figure 14: Stop Instances

Congratulations! You are up and running with Clear Linux OS on AWS. To see what you can do with your Clear Linux OS instance, visit our tutorials section for examples on using your Clear Linux OS system.