Name some AWS components and services that provide compute resources

13 August 2024

Question

Name some AWS components and services that provide compute resources, for instance ways to run VMs, containers or serverless?

Answer

AWS offers a variety of services and components to provide compute resources, allowing users to run virtual machines, containers, and serverless applications. Here are some of the key services:

  • Amazon EC2 (Elastic Compute Cloud): Provides resizable compute capacity in the cloud. Users can launch virtual machines, known as instances, with different configurations to meet their needs. EC2 supports various operating systems and instance types for diverse use cases.
    # Example: Launching an EC2 instance
    aws ec2 run-instances --image-id ami-0abcdef1234567890 --count 1 --instance-type t2.micro --key-name MyKeyPair
    
  • AWS Lambda: Offers serverless compute capabilities, allowing users to run code in response to events without provisioning or managing servers. Lambda functions can be triggered by AWS services like S3, DynamoDB, or API Gateway.
    # Example: Creating a Lambda function
    aws lambda create-function --function-name MyFunction --runtime python3.8 
    --role arn:aws:iam::123456789012:role/service-role/MyRole --handler lambda_function.lambda_handler  --zip-file fileb://function.zip
    
  • Amazon ECS (Elastic Container Service): A container orchestration service that supports Docker containers. ECS allows users to run and manage containers on a cluster of EC2 instances, integrating with other AWS services for scaling and management.
    # Example: Creating an ECS cluster
    aws ecs create-cluster --cluster-name MyCluster
    
  • Amazon EKS (Elastic Kubernetes Service): A managed Kubernetes service that simplifies running Kubernetes clusters on AWS. EKS handles the setup, scaling, and management of Kubernetes, making it easier to deploy and manage containerized applications.
    # Example: Creating an EKS cluster
    aws eks create-cluster --name MyCluster --role-arn arn:aws:iam::123456789012:role/EKSRole 
    --resources-vpc-config subnetIds=subnet-12345678,subnet-87654321
    
  • AWS Fargate: A serverless compute engine for containers that works with both ECS and EKS. Fargate allows users to run containers without managing the underlying EC2 instances, simplifying container deployments and scaling.
    # Example: Creating a Fargate task definition
    aws ecs register-task-definition --family MyTaskDefinition --network-mode awsvpc 
    --container-definitions '[{"name":"MyContainer","image":"my-image","memory":512,"cpu":256}]'
    
  • Amazon Lightsail: Provides an easy-to-use VPS (Virtual Private Server) option with a simplified management interface. Lightsail is ideal for simple applications and provides a straightforward way to launch and manage virtual machines.
    # Example: Creating a Lightsail instance
    aws lightsail create-instances --instance-names MyInstance --availability-zone us-east-1a 
    --blueprint-id amazon_linux_2 --bundle-id micro_2_0
    

These services cover a broad spectrum of compute needs, from traditional VMs to modern container and serverless architectures, catering to different application requirements and deployment preferences.