#352 Add how to create aws instance
Opened 2 months ago by phsmoura. Modified a month ago
phsmoura/infra-docs-fpo create_aws_instance  into  master

@@ -0,0 +1,92 @@ 

+ = How to Create an Instance on AWS

+ 

+ This guide outlines the process of creating an instance on AWS, covering everything from prerequisites to connecting to the created virtual machine. It includes instructions for accessing the EC2 console, selecting an AMI, configuring the instance type, network, storage, and advanced options like initialization scripts. After reviewing the configurations, the user launches the instance, configures an SSH key for access, and verifies its status. Finally, the guide explains how to connect to the instance via SSH, ensuring proper configuration and use of the cloud infrastructure.

+ 

+ == Prerequisites

+ 

+ Before starting, ensure you have:

+ 

+ - Access to the AWS Management Console.

+ - Permissions to create instances on Amazon EC2.

+ 

+ == Step-by-Step Guide

+ 

+ === 1. Access the EC2 Console

+ 

+ 1. Log in to the `AWS Management Console` via Ipsilon https://id.fedoraproject.org/saml2/SSO/Redirect?SPIdentifier=urn:amazon:webservices&RelayState=https://console.aws.amazon.com[through this link]. You can check how to access the **AWS Console** https://docs.fedoraproject.org/en-US/infra/sysadmin_guide/aws-access/#_accessing_the_aws_console[here].

+ 2. In the services menu, locate and click on **EC2** (Elastic Compute Cloud).

+ 

+ === 2. Start the Creation Process

+ 

+ 1. On the EC2 homepage, click **Instances** and then **Launch Instances**.

+ 2. On the next screen, enter a name for your instance in the **Name and tags** field.

+ 3. Select an Amazon Machine Image (AMI) containing the desired operating system.

+ 

+ === 3. Select the Instance Type

+ 

+ 1. Choose the instance type based on your resource requirements (CPU, memory, etc.).

+ 

+ === 4. Choose or Create an SSH Key

+ 

+ 1. Select an existing SSH key or create a new one to access the instance.

+    - If creating a new one, download and securely store the `.pem` file.

+    - You will need this key to access the instance via SSH.

+ 

+ Note here that if the instance will be managed by ansible there's an ansible key

+ 

+ === 5. Configure Network Settings

+ 

+ 1. Ensure the instance is in a **VPC** (Virtual Private Cloud).

+ 2. Select an existing subnet (preferably in a specific availability zone).

+ 3. Configure the **Security Group** or select an existing one:

+    - Allow the necessary ports (e.g., `22` for SSH or `80` for HTTP).

+ 

+ === 6. Configure Storage

+ 

+ 1. Set the storage volume for the instance.

+ 

+ === 7. Advanced Configurations (Optional)

+ 

+ 1. Configure initialization scripts (User Data) if necessary.

+    - Example script to install a web server on Linux:

+      ```bash

+      #!/bin/bash

+      sudo dnf update -y

+      sudo dnf install -y httpd

+      sudo systemctl start httpd

+      sudo systemctl enable httpd

+      ```

+ 2. Select IAM roles or profiles, if necessary, to grant specific permissions to the instance.

+ 

+ === 8. Review and Launch

+ 

+ 1. Review all the configurations of your instance.

+ 2. Click **Launch**.

+ 

+ === 9. Confirm the Launch

+ 

+ 1. Click **Launch Instances**.

+ 2. You will be redirected to a confirmation page.

+ 

+ === 10. Verify the Status

+ 

+ 1. Return to the EC2 dashboard and click on **Instances** in the side menu.

+ 2. Wait until the instance status changes to **Running**.

+ 

+ == Connecting to the Instance

+ 

+ === Via SSH

+ 

+ 1. Open the terminal.

+ 2. Use the following command to connect to the instance:

+    ```bash

+    ssh -i /path/to/your-key.pem ec2-user@Instance-IP

+    ```

+ 

+ == Tags

+ 

+ Every new instance must be configured with tags. It is necessary to define at least the "FedoraGroup" tag to associate it with a group in the instance and the storage volume.

+ 

+ == Conclusion

+ 

+ Congratulations! You have successfully created and accessed your instance on AWS. Use it as needed for your projects or experiments.

Might note here that you want to usually use the ansible ssh key if it's going to be an instance managed by or used via ansible

Can you add a section in here noting that you need to go and set the tag 'FedoraGroup' to some group on both the instance and it's storage volume?
The group names are the part after the aws- in the group name you are accessing, ie, 'infra' for us usually.

1 new commit added

  • Added section about tags
a month ago
Metadata