Thursday 19 September 2024

API Gateway AWS labs step by step

 

1. Create an API

  • Navigate to API Gateway Console: In the AWS Management Console, search for "API Gateway" and select the service.
  • Create API: Click "Create API".
  • Choose API Type: Select the desired API type (e.g., REST API, WebSocket API).
  • Configure API:
    • Name: Provide a meaningful name.
    • Description: Provide an optional description.
  • Create API: Click "Create API".
  • Image of AWS API Gateway Console showing the creation of an API

2. Create a Resource

  • Select API: Choose the newly created API.
  • Create Resource: Click "Actions" -> "Create Resource".
  • Configure Resource:
    • Resource path: Specify the path for the resource (e.g., "/hello").
  • Create Resource: Click "Create Resource".
  • Image of AWS API Gateway Console showing the creation of a resource

3. Create a Method

  • Select Resource: Choose the newly created resource.
  • Create Method: Click "Actions" -> "Create Method".
  • Choose Method: Select the HTTP method (e.g., GET, POST).
  • Configure Method:
    • Integration type: Choose the integration type (e.g., Lambda function).
    • Integration configuration: Configure the integration with your Lambda function.
  • Create Method: Click "Create Method".
  • Image of AWS API Gateway Console showing the creation of a method

4. Configure the Method

  • Select Method: Choose the newly created method.
  • Configure Method:
    • Authorization: Configure authorization settings (e.g., API key, IAM authorization).
    • Request validation: Configure request validation settings.
    • Integration: Configure the integration with your Lambda function (if applicable).
  • Save: Click "Save".
  • Image of AWS API Gateway Console showing the configuration of a method

5. Deploy the API

  • Select API: Choose the API you want to deploy.
  • Deploy API: Click "Actions" -> "Deploy API".
  • Choose Stage: Choose the stage for deployment (e.g., "dev", "prod").
  • Deploy: Click "Deploy".
  • Image of AWS API Gateway Console showing the deployment of an API

6. Test the API

  • Invoke API: Use a tool like Postman or curl to invoke the API.
  • Verify Response: Verify that the API returns the expected response.
  • Image of terminal showing the invocation of an API using curl

7. Additional Considerations

  • API Types: Choose the appropriate API type based on your workload requirements (e.g., REST, WebSocket).
  • Integration: Integrate with various backend services like Lambda, HTTP endpoints, or AWS Step Functions.
  • Authorization: Implement appropriate authorization mechanisms to secure your API.
  • Monitoring: Use API Gateway metrics and logging to monitor performance and usage.

Storage Gateway AWS labs step by step

 

1. Create a Storage Gateway

  • Navigate to Storage Gateway Console: In the AWS Management Console, search for "Storage Gateway" and select the service.
  • Create Gateway: Click "Create gateway".
  • Choose Gateway Type: Select the desired gateway type (e.g., file gateway, volume gateway).
  • Configure Gateway:
    • Name: Provide a meaningful name.
    • VPC: Choose the VPC where the gateway will be created.
    • Subnet: Select the subnet within the VPC.
    • Availability Zone: Choose the desired availability zone.
    • Instance type: Select an appropriate instance type for your workload.
  • Create: Click "Create gateway".
  • Image of AWS Storage Gateway Console showing the creation of a gateway

2. Activate the Gateway

  • Activate Gateway: Once the gateway is created, activate it using the provided activation key.
  • Image of AWS Storage Gateway Console showing the activation of a gateway

3. Configure the Gateway

  • File Gateway:
    • Mount Point: Create a mount point on your EC2 instance where you want to access the gateway.
    • Mount Command: Use the appropriate mount command based on your operating system.
  • Volume Gateway:
    • iSCSI Target: Create an iSCSI target on the gateway.
    • Initiator: Configure the iSCSI initiator on your EC2 instance to connect to the target.
  • Image of AWS Storage Gateway Console showing the configuration of a volume gateway

4. Use the Gateway

  • Access Files (File Gateway): Once the gateway is mounted, you can access and use it like any other local file system.
  • Access Volumes (Volume Gateway): Use the iSCSI initiator to access the volumes created on the gateway.
  • Image of EC2 instance terminal showing the use of a volume gateway

5. Additional Considerations

  • Gateway Types: Choose the appropriate gateway type based on your workload requirements (e.g., file sharing, block storage).
  • Performance Optimization: Consider factors like instance type, network latency, and file system type for optimal performance.
  • Data Protection: Implement appropriate backup and recovery mechanisms.
  • Cost Optimization: Evaluate the cost implications of different gateway types and storage options.

S3 Glacier AWS labs step by step

 

1. Create an S3 Glacier Vault

  • Navigate to S3 Console: In the AWS Management Console, search for "S3" and select the service.
  • Create Vault: Click "Create bucket".
  • Configure Vault:
    • Bucket name: Provide a unique name for your vault.
    • Region: Choose the desired region for your vault.
    • Storage class: Select "Glacier" as the storage class.
    • Properties: Configure any additional properties as needed (e.g., encryption, tagging).
  • Create bucket: Click "Create bucket".
  • Image of AWS S3 Console showing the creation of a Glacier vault

2. Upload Files to the Vault

  • Navigate to the Vault: Select the newly created vault.
  • Upload Files: Click "Upload" and select the files you want to archive.
  • Configure Upload:
    • Archive format: Choose the desired archive format (e.g., ZIP, TAR).
    • Description: Provide an optional description for the archive.
    • Encryption: Configure encryption if desired.
  • Upload: Click "Upload".
  • Image of AWS S3 Console showing the upload of files to a Glacier vault

3. Retrieve Files from the Vault

  • Initiate Retrieval: Select the archive you want to retrieve.
  • Initiate Retrieval: Click "Initiate job".
  • Choose Retrieval Type: Select the desired retrieval type (e.g., Standard, Expedited, Bulk).
  • Initiate: Click "Initiate job".
  • Image of AWS S3 Console showing the initiation of a retrieval job

4. Download Retrieved Files

  • Wait for Retrieval: Once the retrieval job completes, you can download the files.
  • Download Files: Click "Download" next to the retrieved archive.
  • Image of AWS S3 Console showing the download of retrieved files

5. Additional Considerations

  • Retrieval Types: Choose the appropriate retrieval type based on your retrieval speed and cost requirements.
  • Lifecycle Management: Use S3 Lifecycle Management to automatically transition files to Glacier after a specified period.
  • Data Protection: Consider encryption and other security measures to protect your archived data.
  • Cost Optimization: Evaluate the cost implications of different retrieval types and storage durations.

FSx aws labs step by step

 

1. Create an FSx File System

  • Navigate to FSx Console: In the AWS Management Console, search for "FSx" and select the service.
  • Create File System: Click "Create file system".
  • Choose File System Type: Select the desired file system type (e.g., Windows File Server, Lustre, OpenZFS).
  • Configure File System:
    • Name: Provide a meaningful name.
    • Deployment type: Choose the desired deployment type (e.g., single-AZ, multi-AZ).
    • Storage capacity: Specify the required storage capacity.
    • Network: Choose the VPC and subnet where the file system will be created.
    • Security groups: Configure security groups to control network access.
    • Tags: Add any relevant tags for organization and management.
  • Create: Click "Create file system".
  • Image of AWS FSx Console showing the creation of a file system

2. Mount the File System

  • Mount Point: Create a mount point on your EC2 instance where you want to access the file system.
  • Mount Command: Use the appropriate mount command based on your operating system and file system type. For example, on Linux:
  • Image of EC2 instance terminal showing the mount command
Bash
sudo mount -t nfs <file-system-DNS-name>:<mount-point> /mnt/fsx

3. Access and Use the File System

  • Access Files: Once the file system is mounted, you can access and use it like any other local file system.
  • Create, Modify, and Delete Files: Perform standard file operations.
  • Test Performance: Evaluate the file system's performance for your specific workload.
  • Image of EC2 instance terminal showing the use of the mounted file system

4. Additional Considerations

  • File System Types: Choose the appropriate file system type based on your workload requirements (e.g., high-performance computing, file sharing).
  • Storage Capacity: Ensure you have sufficient storage capacity for your data.
  • Performance Optimization: Consider factors like network latency, file system type, and instance type for optimal performance.
  • Data Protection: Implement appropriate backup and recovery mechanisms.

AWS Elastic Disaster Recovery labs step by step

 

1. Create an Elastic Disaster Recovery (EDR) Replication Instance

  • Navigate to EDR Console: In the AWS Management Console, search for "Elastic Disaster Recovery" and select the service.
  • Create Replication Instance: Click "Create replication instance".
  • Configure Instance:
    • Name: Provide a meaningful name.
    • Instance type: Choose an appropriate instance type based on your workload.
    • Availability Zone: Select the desired availability zone.
    • IAM role: Create a new IAM role with necessary permissions to access EC2, S3, and other required resources.
    • Tags: Add any relevant tags for organization and management.
  • Create: Click "Create replication instance".
  • Image of Elastic Disaster Recovery Console showing the creation of a replication instance

2. Create a Replication Configuration

  • Navigate to Replication Configurations: In the EDR console, select "Replication configurations".
  • Create Replication Configuration: Click "Create replication configuration".
  • Configure Replication:
    • Name: Provide a meaningful name.
    • Replication instance: Select the previously created replication instance.
    • Source VPC: Choose the VPC containing your source resources.
    • Target VPC: Choose the VPC where the disaster recovery resources will be deployed.
    • Replication settings: Configure replication settings like replication frequency, data transfer rate, and retention policy.
  • Create: Click "Create replication configuration".
  • Image of Elastic Disaster Recovery Console showing the creation of a replication configuration

3. Create a Replication Group

  • Navigate to Replication Groups: In the EDR console, select "Replication groups".
  • Create Replication Group: Click "Create replication group".
  • Configure Replication Group:
    • Name: Provide a meaningful name.
    • Replication configuration: Select the previously created replication configuration.
    • Replication group type: Choose the desired replication group type (e.g., manual, automated).
    • Failover settings: Configure failover settings like failover mode and automatic failover triggers.
  • Create: Click "Create replication group".
  • Image of Elastic Disaster Recovery Console showing the creation of a replication group

4. Add Resources to the Replication Group

  • Select Replication Group: Choose the newly created replication group.
  • Add Resources: Click "Add resources".
  • Select Resources: Choose the EC2 instances or other resources you want to replicate.
  • Add: Click "Add".
  • Image of Elastic Disaster Recovery Console showing the addition of resources to a replication group

5. Test Failover

  • Select Replication Group: Choose the desired replication group.
  • Initiate Failover: Click "Initiate failover".
  • Confirm Failover: Confirm the failover operation.
  • Image of Elastic Disaster Recovery Console showing the initiation of a failover

EFS AWS labs step by step

Step 1: Set Up Your AWS Account

  1. Sign In: Log into your AWS Management Console.
  2. IAM User: Ensure you have an IAM user with appropriate permissions (AmazonElasticFileSystemFullAccess).

Step 2: Create an EFS File System

  1. Navigate to EFS:

    • In the AWS Management Console, search for “EFS” and select Elastic File System.
  2. Create File System:

    • Click on Create file system.
    • Select your VPC and availability zones.
    • Choose the performance mode (General Purpose or Max I/O) based on your use case.
    • Configure throughput mode (Bursting or Provisioned).
    • (Optional) Enable encryption at rest and in transit.
    • Click Create file system.

Step 3: Configure EFS Mount Targets

  1. Mount Targets:
    • After creating the file system, click on it to view details.
    • Click on Network and then Add mount targets.
    • Select subnets (in different availability zones for redundancy).
    • Specify security groups to control access.
    • Click Add mount targets.

Step 4: Create an EC2 Instance to Access EFS

  1. Launch EC2 Instance:
    • Navigate to EC2 in the AWS Management Console.
    • Click on Launch Instance.
    • Choose an Amazon Machine Image (AMI), such as Amazon Linux 2.
    • Select an instance type (e.g., t2.micro for testing).
    • Configure network settings to ensure the instance is in the same VPC as the EFS.
    • (Optional) Create or select an existing security group allowing NFS access (port 2049).
    • Click Launch.

Step 5: Install NFS Client on EC2

  1. Connect to EC2 Instance:

    • Use SSH to connect to your EC2 instance.
  2. Install NFS Utilities:

    bash

    sudo yum install -y nfs-utils # For Amazon Linux

Step 6: Mount the EFS File System

  1. Create a Mount Point:

    bash

    sudo mkdir /mnt/efs
  2. Mount EFS:

    • Use the EFS DNS name to mount:
    bash

    sudo mount -t nfs4 <EFS-DNS-NAME>:/ /mnt/efs
    • Replace <EFS-DNS-NAME> with the actual DNS name from your EFS console.
  3. Verify Mount:

    bash

    df -h

Step 7: Test EFS

  1. Create a Test File:

    bash

    echo "Hello EFS" | sudo tee /mnt/efs/testfile.txt
  2. Verify File:

    bash

    cat /mnt/efs/testfile.txt

Step 8: Configure Automatic Mounting (Optional)

  1. Edit fstab:

    • Open the fstab file:
    bash

    sudo nano /etc/fstab
  2. Add EFS Entry:

    • Add the following line at the end of the file:
    javascript

    <EFS-DNS-NAME>:/ /mnt/efs nfs4 defaults,_netdev 0 0
  3. Test fstab:

    bash

    sudo umount /mnt/efs sudo mount -a

Step 9: Clean Up

  1. Unmount EFS:


    sudo umount /mnt/efs
  2. Delete EC2 Instance:

    • Navigate to the EC2 console and terminate the instance.
  3. Delete EFS File System:

    • Go back to the EFS console and delete the file system.

AWS Backup labs step by step

 

Step 1: Set Up Your AWS Account

  1. Sign In: Log into your AWS Management Console.
  2. IAM User: Ensure you have an IAM user with appropriate permissions (AWSBackupFullAccess is a good starting point).

Step 2: Create a Backup Vault

  1. Navigate to AWS Backup:
    • In the AWS Management Console, search for “Backup” and select AWS Backup.
  2. Create Backup Vault:
    • Click on Backup vaults in the left navigation pane.
    • Click on Create backup vault.
    • Provide a name for your vault.
    • (Optional) Configure encryption settings and resource policy.
    • Click Create backup vault.

Step 3: Set Up a Backup Plan

  1. Create Backup Plan:
    • Click on Backup plans in the left pane.
    • Click on Create backup plan.
    • Choose Build a new plan or Use a template.
  2. Configure Backup Plan:
    • Provide a name and optional description.
    • Set the backup rule details (frequency, backup window, lifecycle rules).
    • Choose the backup vault created in Step 2.
    • Click Create plan.

Step 4: Assign Resources to the Backup Plan

  1. Assign Resources:
    • After creating the backup plan, you’ll see an option to Assign resources.
    • Click on it and choose the resource type (e.g., EC2, EFS).
    • Specify the resource ID (e.g., instance IDs for EC2).
    • Optionally tag resources for dynamic assignment.
    • Click Assign resources.

Step 5: Manually Trigger a Backup

  1. Go to Backup Jobs:
    • Click on Backup jobs in the left pane.
  2. Create a Backup Job:
    • Click on Create backup job.
    • Select the backup plan you created earlier or choose specific resources.
    • Review settings and click Create backup job.
  3. Monitor Backup Jobs:
    • You can view the progress and status of backup jobs under the Backup jobs section.

Step 6: Restore from Backup

  1. Navigate to Recovery:

    • Click on Protected resources in the left pane.
    • Select the resource you want to restore.
  2. Restore Resource:

    • Click on Actions and choose Restore.
    • Specify restore options (e.g., restore location).
    • Click Restore and monitor the progress.

Step 7: Clean Up

  1. Delete Backup Vault:

    • Ensure that all backups are deleted from the vault.
    • Click on the vault name, then select Delete vault.
  2. Remove Backup Plans:

    • Delete any created backup plans if not needed.
  3. IAM Users and Permissions:

    • Review and remove any unnecessary IAM users or policies created for the lab.