20
Writing C Program On AWS AWS EC2 DEMO 1 SEEM3460/ESTR3504

Writing C AWS EC2 DEMO Program On AWSseem3460/lecture/AWS-EC2-Demo-2020.pdfSelect your ec2-demo.pem file for the key pair that you specified when you launched your instance and choose

  • Upload
    others

  • View
    5

  • Download
    0

Embed Size (px)

Citation preview

  • Writing C Program On AWS

    AWS EC2 DEMO

    1

    SEEM3460/ESTR3504

  • Open the Amazon EC2 console at https://console.aws.amazon.com/ec2

    Choose Launch Instance

    2SEEM3460/ESTR3504

  • Select an HVM version of Amazon Linux 2

    3SEEM3460/ESTR3504

  • Select the t2.micro instance type, which is selected by default

    Choose Review and Launch

    4SEEM3460/ESTR3504

  • On the Review Instance Launch page, choose Launch

    5SEEM3460/ESTR3504

  • Choose Create a new key pair, enter a Key pair name, for example, ec2-demo

    6SEEM3460/ESTR3504

  • Choose Download key pair, the private key will be downloaded to your local computer. Select an appropriate directory to save it

    Then, choose Launch Instances

    A confirmation page lets you know that your instance is launching. Choose View Instances to close the confirmation page and return to the console

    7SEEM3460/ESTR3504

  • On the Instances screen, you can view the status of the launch

    Mark down the Public DNS (IPv4) which will be used when connecting to the instance.

    8SEEM3460/ESTR3504

  • PuTTY does not natively support the private key format for SSH keys.

    PuTTY provides a tool named PuTTYgen, which converts keys to the required format for PuTTY.

    You must convert your private key (.pem file) into this format (.ppk file) as follows in order to connect to your instance using PuTTY.

    9SEEM3460/ESTR3504

  • Open PuTTYgen.

    Under Type of key to generate, choose RSA

    10SEEM3460/ESTR3504

  • Choose Load. By default, PuTTYgen displays only files with the extension .ppk.

    To locate your .pem file, choose the option to display files of all types.

    11SEEM3460/ESTR3504

  • Select your ec2-demo.pem file for the key pair that you specified when you launched your instance and choose Open.

    PuTTYgen displays a notice that the .pem file was successfully imported. Choose OK.

    12SEEM3460/ESTR3504

  • Choose Save private key.

    PuTTYgen displays a warning about saving the key without a passphrase. Choose Yes.

    Specify the same name for the key that you used for the key pair (for example, ec2-demo) and choose Save.

    13SEEM3460/ESTR3504

  • Open PuTTY

    In the Category pane, choose Session and complete the following fields: In the Host Name box, enter ec2-user@your-Public DNS(IPv4).

    Ensure that the Port value is 22.

    Under Connection type, select SSH.

    14SEEM3460/ESTR3504

  • In the Category pane, expand Connection, expand SSH, and then choose Auth. Complete the following: Choose Browse.

    Select the .ppk file that you generated for your key pair and choose Open.

    Choose Open.

    15SEEM3460/ESTR3504

  • 16

    Now, you have connected to your ec2 instance.

    SEEM3460/ESTR3504

  • Run the following command: sudo yum install gcc

    You can type gcc to check if gcc is installed.

    17SEEM3460/ESTR3504

  • Now, you can complie the C program as ussual way.

    Run gcc main1.c reverse.c -o main1

    The executable main1 will be generated.

    18SEEM3460/ESTR3504

  • Also, you can use the make utility.

    Run make –f main1.make

    19SEEM3460/ESTR3504

  • You should clean up the instance by terminating the instance after this tutorial.

    Choose Actions, Instance State, Terminate.

    Choose Yes, Terminate when prompted for confirmation.

    20SEEM3460/ESTR3504