Compute Services
A comprehensive developer cheatsheet covering AWS core compute services, including EC2, Lambda, ECS, EKS, Auto Scaling, and Elastic Load Balancing (ALB).
EC2 — Elastic Compute Cloud
EC2 provides resizable virtual servers (instances) in the cloud.
Listing & Describing Instances
List All EC2 Instances:
$ aws ec2 describe-instances
{
"Reservations": [
{
"Instances": [
{
"InstanceId": "i-0dae5d4daa47fe4a2",
"InstanceType": "t2.micro",
"State": {
"Name": "running"
},
"PublicIpAddress": "54.123.45.67",
"PrivateIpAddress": "10.0.1.100",
"LaunchTime": "2026-01-15T10:30:15.000Z"
}
]
}
]
}Lists all EC2 instances with their details.
Filtered Query for Instance IDs and Names:
$ aws ec2 describe-instances --query 'Reservations[*].Instances[*].[InstanceId,InstanceType,State.Name,Tags[?Key==`Name`].Value]' --output table
|-------------------------------------------------|
| i-0dae5d4daa47fe4a2 | t2.micro | running | web-server |
| i-1bcf6e5ebf68fe5b3 | t3.medium | stopped | db-server |
--querywith JMESPath filters output to show only specific fields.
List Instances with Specific State:
$ aws ec2 describe-instances --filters Name=instance-state-name,Values=running --query 'Reservations[*].Instances[*].[InstanceId,InstanceType]' --output tableList Instances by Tag:
$ aws ec2 describe-instances --filters Name=tag:Environment,Values=production --query 'Reservations[*].Instances[*].[InstanceId,Tags[?Key==`Name`].Value]' --output tableManaging EC2 Instances
Start an EC2 Instance:
$ aws ec2 start-instances --instance-ids i-0dae5d4daa47fe4a2
{
"StartingInstances": [
{
"InstanceId": "i-0dae5d4daa47fe4a2",
"CurrentState": {
"Name": "pending"
},
"PreviousState": {
"Name": "stopped"
}
}
]
}Starts a stopped EC2 instance.
Stop an EC2 Instance:
$ aws ec2 stop-instances --instance-ids i-0dae5d4daa47fe4a2
{
"StoppingInstances": [
{
"InstanceId": "i-0dae5d4daa47fe4a2",
"CurrentState": {
"Name": "stopping"
},
"PreviousState": {
"Name": "running"
}
}
]
}Reboot an EC2 Instance:
$ aws ec2 reboot-instances --instance-ids i-0dae5d4daa47fe4a2
(No output on success)Terminate an EC2 Instance:
$ aws ec2 terminate-instances --instance-ids i-0dae5d4daa47fe4a2
{
"TerminatingInstances": [
{
"InstanceId": "i-0dae5d4daa47fe4a2",
"CurrentState": {
"Name": "shutting-down"
},
"PreviousState": {
"Name": "running"
}
}
]
}** Permanently deletes the instance** — cannot be recovered!
Wait for Instance State Change:
$ aws ec2 wait instance-running --instance-ids i-0dae5d4daa47fe4a2
(No output — waits until instance is running)
$ aws ec2 wait instance-stopped --instance-ids i-0dae5d4daa47fe4a2
(No output — waits until instance is stopped)
$ aws ec2 wait instance-terminated --instance-ids i-0dae5d4daa47fe4a2
(No output — waits until instance is terminated)Creating & Launching EC2 Instances
Launch a New EC2 Instance:
$ aws ec2 run-instances \
--image-id ami-0abcdef1234567890 \
--instance-type t2.micro \
--key-name my-key-pair \
--security-group-ids sg-12345678 \
--subnet-id subnet-12345678 \
--user-data file://user-data.sh \
--tag-specifications 'ResourceType=instance,Tags=[{Key=Name,Value=web-server},{Key=Environment,Value=production}]'
{
"Instances": [
{
"InstanceId": "i-0dae5d4daa47fe4a2",
"InstanceType": "t2.micro",
"State": {
"Name": "pending"
},
"PrivateIpAddress": "10.0.1.100",
"PublicIpAddress": "54.123.45.67"
}
]
}Launches a new EC2 instance with specified parameters.
Get AMI ID from SSM Parameter Store (Amazon Linux 2):
$ aws ssm get-parameters --names /aws/service/ami-amazon-linux-latest/amzn2-ami-hvm-x86_64-gp2 --query 'Parameters[0].Value' --output text
ami-0abcdef1234567890Get AMI ID for Ubuntu 22.04:
$ aws ec2 describe-images --owners 099720109477 --filters "Name=name,Values=ubuntu/images/hvm-ssd/ubuntu-jammy-22.04-amd64-server-*" "Name=state,Values=available" --query 'Images[*].[ImageId,CreationDate]' --output table | sort -k2 -r | head -1
ami-0abcdef1234567890 2026-01-15T10:30:15.000ZEC2 Key Pairs
List Key Pairs:
$ aws ec2 describe-key-pairs --query 'KeyPairs[*].[KeyName]' --output table
|------------------|
| my-key-pair |
| production-key |Create a New Key Pair:
$ aws ec2 create-key-pair --key-name new-key --query 'KeyMaterial' --output text > new-key.pem
chmod 400 new-key.pemCreates a new key pair and saves the private key to a file. The private key is only shown once!
Delete a Key Pair:
$ aws ec2 delete-key-pair --key-name new-keySecurity Groups
List Security Groups:
$ aws ec2 describe-security-groups --query 'SecurityGroups[*].[GroupId,GroupName,Description]' --output table
|-----------------|---------------|-----------------------------|
| sg-12345678 | web-sg | Web server security group |
| sg-87654321 | db-sg | Database security group |Create a Security Group:
$ aws ec2 create-security-group --group-name app-sg --description "Application security group" --vpc-id vpc-12345678
{
"GroupId": "sg-abcdef1234567890"
}Add Inbound Rule (Allow SSH from anywhere):
$ aws ec2 authorize-security-group-ingress --group-id sg-abcdef1234567890 --protocol tcp --port 22 --cidr 0.0.0.0/0Add Inbound Rule (Allow HTTP from anywhere):
$ aws ec2 authorize-security-group-ingress --group-id sg-abcdef1234567890 --protocol tcp --port 80 --cidr 0.0.0.0/0Add Inbound Rule (Allow HTTPS from anywhere):
$ aws ec2 authorize-security-group-ingress --group-id sg-abcdef1234567890 --protocol tcp --port 443 --cidr 0.0.0.0/0Add Inbound Rule (Allow from another Security Group):
$ aws ec2 authorize-security-group-ingress --group-id sg-abcdef1234567890 --protocol tcp --port 3306 --source-group sg-87654321Remove Inbound Rule:
$ aws ec2 revoke-security-group-ingress --group-id sg-abcdef1234567890 --protocol tcp --port 22 --cidr 0.0.0.0/0Delete Security Group:
$ aws ec2 delete-security-group --group-id sg-abcdef1234567890** Security group must not be associated with any instances.**
EC2 Instance Metadata
Get Instance Metadata (from inside the instance):
$ curl http://169.254.169.254/latest/meta-data/
ami-id
ami-launch-index
instance-id
instance-type
local-hostname
local-ipv4
public-hostname
public-ipv4
security-groupsGet Specific Metadata:
$ curl http://169.254.169.254/latest/meta-data/instance-id
i-0dae5d4daa47fe4a2
$ curl http://169.254.169.254/latest/meta-data/public-ipv4
54.123.45.67Get User Data:
$ curl http://169.254.169.254/latest/user-data
#!/bin/bash
yum update -y
yum install nginx -y
service nginx startLambda — Serverless Functions
Lambda runs code without provisioning servers. Supports Python, Node.js, Java, Go, .NET, Ruby.
Listing & Managing Functions
List Lambda Functions:
$ aws lambda list-functions --query 'Functions[*].[FunctionName,Runtime,Handler,MemorySize,LastModified]' --output table
|------------------|----------|------------------|-----------|----------------------|
| my-lambda | python3.9| lambda_function.handler | 128 | 2026-01-15T10:30:15.000Z |
| api-handler | nodejs18.x| index.handler | 256 | 2026-01-14T10:30:15.000Z |Get Function Details:
$ aws lambda get-function --function-name my-lambda
{
"Configuration": {
"FunctionName": "my-lambda",
"FunctionArn": "arn:aws:lambda:us-east-1:123456789012:function:my-lambda",
"Runtime": "python3.9",
"Handler": "lambda_function.handler",
"MemorySize": 128,
"Timeout": 30,
"LastModified": "2026-01-15T10:30:15.000Z"
},
"Code": {
"Location": "https://lambda.../my-lambda"
}
}Invoking Lambda Functions
Invoke Lambda (Synchronous):
$ aws lambda invoke --function-name my-lambda --payload '{"key":"value"}' response.json
{
"StatusCode": 200,
"ExecutedVersion": "$LATEST"
}
$ cat response.json
{"status":"success","message":"Hello from Lambda"}Executes a Lambda function synchronously and saves output to
response.json.
Invoke Lambda (Asynchronous — Fire and Forget):
$ aws lambda invoke --function-name my-lambda --invocation-type Event --payload '{"key":"value"}' response.json
{
"StatusCode": 202
}Invoke Lambda with CLI (No Payload):
$ aws lambda invoke --function-name my-lambda response.jsonCreating & Updating Lambda Functions
Create Lambda Function (Python):
$ aws lambda create-function \
--function-name my-new-lambda \
--runtime python3.9 \
--role arn:aws:iam::123456789012:role/LambdaExecutionRole \
--handler lambda_function.handler \
--zip-file fileb://function.zip \
--memory-size 256 \
--timeout 30
{
"FunctionName": "my-new-lambda",
"FunctionArn": "arn:aws:lambda:us-east-1:123456789012:function:my-new-lambda",
"Runtime": "python3.9",
"Handler": "lambda_function.handler",
"MemorySize": 256,
"Timeout": 30,
"LastModified": "2026-01-15T10:30:15.000Z"
}Update Lambda Code:
$ aws lambda update-function-code --function-name my-new-lambda --zip-file fileb://updated-function.zip
{
"FunctionName": "my-new-lambda",
"LastModified": "2026-01-15T10:30:20.000Z",
"CodeSize": 123456
}Update Lambda Configuration:
$ aws lambda update-function-configuration --function-name my-new-lambda --memory-size 512 --timeout 60Add Environment Variable:
$ aws lambda update-function-configuration --function-name my-new-lambda --environment 'Variables={ENV=production,LOG_LEVEL=debug}'Update Environment Variables Only:
$ aws lambda update-function-configuration --function-name my-new-lambda --environment 'Variables={ENV=staging}'Lambda Permissions
Add Permission (Allow S3 to Invoke):
$ aws lambda add-permission \
--function-name my-lambda \
--statement-id s3-invoke \
--action lambda:InvokeFunction \
--principal s3.amazonaws.com \
--source-arn arn:aws:s3:::my-bucket
{
"Statement": "{\"Sid\":\"s3-invoke\",\"Effect\":\"Allow\",\"Principal\":{\"Service\":\"s3.amazonaws.com\"},\"Action\":\"lambda:InvokeFunction\",\"Resource\":\"arn:aws:lambda:us-east-1:123456789012:function:my-lambda\",\"Condition\":{\"ArnLike\":{\"AWS:SourceArn\":\"arn:aws:s3:::my-bucket\"}}}"
}Remove Permission:
$ aws lambda remove-permission --function-name my-lambda --statement-id s3-invokeLambda Logging (CloudWatch)
Get Lambda Logs:
$ aws logs describe-log-groups --log-group-name-prefix /aws/lambda/my-lambda
{
"logGroups": [
{
"logGroupName": "/aws/lambda/my-lambda",
"creationTime": 1234567890123
}
]
}Get Log Streams:
$ aws logs describe-log-streams --log-group-name /aws/lambda/my-lambdaView Recent Logs:
$ aws logs get-log-events --log-group-name /aws/lambda/my-lambda --log-stream-name "2026/01/15/[$LATEST]abcdef" --limit 10ECS — Elastic Container Service
ECS is a managed container orchestration service for Docker containers.
Clusters
List ECS Clusters:
$ aws ecs list-clusters
{
"clusterArns": [
"arn:aws:ecs:us-east-1:123456789012:cluster/my-cluster",
"arn:aws:ecs:us-east-1:123456789012:cluster/production"
]
}Describe a Cluster:
$ aws ecs describe-clusters --clusters my-cluster
{
"clusters": [
{
"clusterName": "my-cluster",
"status": "ACTIVE",
"registeredContainerInstancesCount": 3,
"runningTasksCount": 5,
"pendingTasksCount": 0
}
]
}Create a New Cluster:
$ aws ecs create-cluster --cluster-name new-cluster
{
"cluster": {
"clusterName": "new-cluster",
"status": "ACTIVE"
}
}Delete a Cluster:
$ aws ecs delete-cluster --cluster new-cluster** Cluster must have no services or tasks running.**
Services
List Services in a Cluster:
$ aws ecs list-services --cluster my-cluster
{
"serviceArns": [
"arn:aws:ecs:us-east-1:123456789012:service/my-cluster/web-service",
"arn:aws:ecs:us-east-1:123456789012:service/my-cluster/api-service"
]
}Describe a Service:
$ aws ecs describe-services --cluster my-cluster --services web-service
{
"services": [
{
"serviceName": "web-service",
"status": "ACTIVE",
"desiredCount": 3,
"runningCount": 3,
"pendingCount": 0,
"taskDefinition": "web-task:5"
}
]
}Create a Service (Fargate):
$ aws ecs create-service \
--cluster my-cluster \
--service-name web-service \
--task-definition web-task:1 \
--desired-count 3 \
--launch-type FARGATE \
--network-configuration "awsvpcConfiguration={subnets=[subnet-12345678],securityGroups=[sg-12345678],assignPublicIp=ENABLED}"
{
"service": {
"serviceName": "web-service",
"status": "ACTIVE",
"desiredCount": 3,
"runningCount": 0
}
}Update Service (Scale Tasks):
$ aws ecs update-service --cluster my-cluster --service web-service --desired-count 5
{
"service": {
"serviceName": "web-service",
"desiredCount": 5,
"runningCount": 3
}
}Update Service (Force New Deployment):
$ aws ecs update-service --cluster my-cluster --service web-service --force-new-deploymentDelete a Service:
$ aws ecs delete-service --cluster my-cluster --service web-service** Use
--forceto delete without confirmation.**
Task Definitions
List Task Definitions:
$ aws ecs list-task-definitions
{
"taskDefinitionArns": [
"arn:aws:ecs:us-east-1:123456789012:task-definition/web-task:1",
"arn:aws:ecs:us-east-1:123456789012:task-definition/web-task:2",
"arn:aws:ecs:us-east-1:123456789012:task-definition/api-task:1"
]
}Register a Task Definition (Fargate):
$ aws ecs register-task-definition \
--family web-task \
--network-mode awsvpc \
--requires-compatibilities FARGATE \
--cpu 256 \
--memory 512 \
--execution-role-arn arn:aws:iam::123456789012:role/ecsTaskExecutionRole \
--container-definitions file://container-def.jsonExample container-def.json:
[
{
"name": "web-container",
"image": "nginx:latest",
"cpu": 256,
"memory": 512,
"essential": true,
"portMappings": [
{
"containerPort": 80,
"protocol": "tcp"
}
],
"environment": [
{
"name": "ENV",
"value": "production"
}
]
}
]Deregister Task Definition:
$ aws ecs deregister-task-definition --task-definition web-task:1Tasks
Run a Task (One-off):
$ aws ecs run-task --cluster my-cluster --task-definition web-task:1
{
"tasks": [
{
"taskArn": "arn:aws:ecs:us-east-1:123456789012:task/my-cluster/abc123",
"desiredStatus": "RUNNING",
"lastStatus": "RUNNING"
}
]
}List Running Tasks:
$ aws ecs list-tasks --cluster my-cluster
{
"taskArns": [
"arn:aws:ecs:us-east-1:123456789012:task/my-cluster/abc123"
]
}Stop a Task:
$ aws ecs stop-task --cluster my-cluster --task abc123EKS — Elastic Kubernetes Service
EKS is a managed Kubernetes service.
Clusters
List EKS Clusters:
$ aws eks list-clusters
{
"clusters": ["my-eks-cluster", "production-cluster"]
}Describe an EKS Cluster:
$ aws eks describe-cluster --name my-eks-cluster
{
"cluster": {
"name": "my-eks-cluster",
"arn": "arn:aws:eks:us-east-1:123456789012:cluster/my-eks-cluster",
"status": "ACTIVE",
"version": "1.28",
"endpoint": "https://EKS_ENDPOINT.yl4.us-east-1.eks.amazonaws.com",
"createdAt": "2026-01-15T10:30:15.000Z",
"platformVersion": "eks.5"
}
}Update Kubeconfig for EKS:
$ aws eks update-kubeconfig --name my-eks-cluster
Added new context arn:aws:eks:us-east-1:123456789012:cluster/my-eks-cluster to ~/.kube/configConfigures
kubectlto connect to your EKS cluster.
Update Kubeconfig for Specific Profile:
$ aws eks update-kubeconfig --name my-eks-cluster --profile productionCreate an EKS Cluster:
$ aws eks create-cluster \
--name new-eks-cluster \
--role-arn arn:aws:iam::123456789012:role/eks-cluster-role \
--resources-vpc-config subnetIds=subnet-12345678,subnet-87654321,securityGroupIds=sg-12345678
{
"cluster": {
"name": "new-eks-cluster",
"status": "CREATING"
}
}Wait for Cluster Creation:
$ aws eks wait cluster-active --name new-eks-clusterDelete EKS Cluster:
$ aws eks delete-cluster --name new-eks-cluster
{
"cluster": {
"name": "new-eks-cluster",
"status": "DELETING"
}
}** Deleting a cluster is irreversible.**
Node Groups
List Node Groups:
$ aws eks list-nodegroups --cluster-name my-eks-cluster
{
"nodegroups": ["managed-ng-1", "managed-ng-2"]
}Describe Node Group:
$ aws eks describe-nodegroup --cluster-name my-eks-cluster --nodegroup-name managed-ng-1
{
"nodegroup": {
"nodegroupName": "managed-ng-1",
"status": "ACTIVE",
"instanceTypes": ["t3.medium"],
"desiredSize": 3,
"minSize": 2,
"maxSize": 5
}
}Create Node Group:
$ aws eks create-nodegroup \
--cluster-name my-eks-cluster \
--nodegroup-name new-ng \
--subnets subnet-12345678 \
--node-role arn:aws:iam::123456789012:role/eks-node-role \
--instance-types t3.medium \
--desired-size 3Update Node Group (Scale):
$ aws eks update-nodegroup-config --cluster-name my-eks-cluster --nodegroup-name new-ng --desired-size 5Delete Node Group:
$ aws eks delete-nodegroup --cluster-name my-eks-cluster --nodegroup-name new-ngAuto Scaling
EC2 Auto Scaling
List Auto Scaling Groups:
$ aws autoscaling describe-auto-scaling-groups --query 'AutoScalingGroups[*].[AutoScalingGroupName,DesiredCapacity,MinSize,MaxSize]' --output table
|------------------|-----------------|---------|---------|
| web-asg | 3 | 2 | 10 |
| db-asg | 1 | 1 | 3 |Describe Auto Scaling Group:
$ aws autoscaling describe-auto-scaling-groups --auto-scaling-group-names web-asg
{
"AutoScalingGroups": [
{
"AutoScalingGroupName": "web-asg",
"DesiredCapacity": 3,
"MinSize": 2,
"MaxSize": 10,
"LaunchTemplate": {
"LaunchTemplateName": "web-launch-template",
"Version": "$Latest"
}
}
]
}Update Auto Scaling Group (Change Desired Capacity):
$ aws autoscaling set-desired-capacity --auto-scaling-group-name web-asg --desired-capacity 5Update Auto Scaling Group (Change Min/Max):
$ aws autoscaling update-auto-scaling-group --auto-scaling-group-name web-asg --min-size 3 --max-size 15Create Auto Scaling Group:
$ aws autoscaling create-auto-scaling-group \
--auto-scaling-group-name new-asg \
--launch-template LaunchTemplateName=web-launch-template,Version='$Latest' \
--min-size 2 \
--max-size 10 \
--desired-capacity 3 \
--vpc-zone-identifier "subnet-12345678,subnet-87654321"Delete Auto Scaling Group:
$ aws autoscaling delete-auto-scaling-group --auto-scaling-group-name new-asg** Use
--force-deleteto delete even with instances.**
Launch Templates
Create Launch Template:
$ aws ec2 create-launch-template \
--launch-template-name web-launch-template \
--launch-template-data file://template-data.jsonExample template-data.json:
{
"ImageId": "ami-0abcdef1234567890",
"InstanceType": "t3.medium",
"SecurityGroupIds": ["sg-12345678"],
"UserData": "IyEvYmluL2Jhc2gK..."
}Elastic Load Balancing (ELB)
Application Load Balancer (ALB)
List Load Balancers:
$ aws elbv2 describe-load-balancers --query 'LoadBalancers[*].[LoadBalancerName,DNSName,State.Code,Type]' --output table
|------------------|---------------------------|---------|----------|
| web-alb | web-alb-123456.elb.amazonaws.com | active | application |
| internal-api | internal-api-123456.elb.amazonaws.com | active | application |Create Application Load Balancer:
$ aws elbv2 create-load-balancer \
--name web-alb \
--subnets subnet-12345678 subnet-87654321 \
--security-groups sg-12345678 \
--scheme internet-facing
{
"LoadBalancers": [
{
"LoadBalancerName": "web-alb",
"DNSName": "web-alb-123456.elb.amazonaws.com",
"State": {
"Code": "provisioning"
}
}
]
}Create Target Group:
$ aws elbv2 create-target-group \
--name web-targets \
--protocol HTTP \
--port 80 \
--vpc-id vpc-12345678 \
--health-check-path /health
{
"TargetGroups": [
{
"TargetGroupName": "web-targets",
"TargetGroupArn": "arn:aws:elasticloadbalancing:us-east-1:123456789012:targetgroup/web-targets/1234567890"
}
]
}Create Listener:
$ aws elbv2 create-listener \
--load-balancer-arn arn:aws:elasticloadbalancing:us-east-1:123456789012:loadbalancer/app/web-alb/1234567890 \
--protocol HTTP \
--port 80 \
--default-actions Type=forward,TargetGroupArn=arn:aws:elasticloadbalancing:us-east-1:123456789012:targetgroup/web-targets/1234567890
{
"Listeners": [
{
"ListenerArn": "arn:aws:elasticloadbalancing:us-east-1:123456789012:listener/app/web-alb/1234567890/1234567890",
"Port": 80,
"Protocol": "HTTP"
}
]
}Register Targets with Target Group:
$ aws elbv2 register-targets \
--target-group-arn arn:aws:elasticloadbalancing:us-east-1:123456789012:targetgroup/web-targets/1234567890 \
--targets Id=i-0dae5d4daa47fe4a2 Id=i-1bcf6e5ebf68fe5b3Deregister Targets:
$ aws elbv2 deregister-targets \
--target-group-arn arn:aws:elasticloadbalancing:us-east-1:123456789012:targetgroup/web-targets/1234567890 \
--targets Id=i-0dae5d4daa47fe4a2Delete Load Balancer:
$ aws elbv2 delete-load-balancer --load-balancer-arn arn:aws:elasticloadbalancing:us-east-1:123456789012:loadbalancer/app/web-alb/1234567890Quick Reference — Most Used Commands
| Task | Command |
|---|---|
| List EC2 instances | aws ec2 describe-instances |
| Start EC2 | aws ec2 start-instances --instance-ids i-xxx |
| Stop EC2 | aws ec2 stop-instances --instance-ids i-xxx |
| Terminate EC2 | aws ec2 terminate-instances --instance-ids i-xxx |
| List security groups | aws ec2 describe-security-groups |
| Add security group rule | aws ec2 authorize-security-group-ingress --group-id sg-xxx --protocol tcp --port 80 --cidr 0.0.0.0/0 |
| List Lambda functions | aws lambda list-functions |
| Invoke Lambda | aws lambda invoke --function-name fn response.json |
| List ECS clusters | aws ecs list-clusters |
| Update ECS service | aws ecs update-service --cluster cluster --service service --desired-count 5 |
| List EKS clusters | aws eks list-clusters |
| Update kubeconfig | aws eks update-kubeconfig --name cluster |
| List ASGs | aws autoscaling describe-auto-scaling-groups |
| Update ASG desired | aws autoscaling set-desired-capacity --auto-scaling-group-name asg --desired-capacity 5 |
| List ALBs | aws elbv2 describe-load-balancers |
| Register targets | aws elbv2 register-targets --target-group-arn arn --targets Id=i-xxx |
Additional Tips
-
Use
--dry-runBefore Destructive Commands:bashaws ec2 terminate-instances --instance-ids i-xxx --dry-run -
Use
--queryfor Filtering:bashaws ec2 describe-instances --query 'Reservations[*].Instances[*].[InstanceId,State.Name]' -
Use
jqfor Parsing JSON:bashaws ec2 describe-instances | jq -r '.Reservations[].Instances[].InstanceId' -
EC2 User Data runs only on first boot. Use
cloud-initfor persistent configuration. -
Lambda Timeout: Max 15 minutes. Use Step Functions for long-running workflows.
-
ECS vs EKS: ECS is simpler (AWS proprietary). EKS is standard Kubernetes (portable).
-
Fargate vs EC2 Launch Types: Fargate is serverless (no EC2 management). EC2 gives more control.