Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions tuts/184-ec2-ebs-volume-types/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Ec2 Ebs Types

A read-only script that queries Ec2 resources and displays information.

## Running

```bash
bash ec2-ebs-types.sh
```

## What it does

1. Listing EBS volume types
2. Listing your volumes by type
3. Describing volume modifications

## Resources created

None — this script is read-only.

## Cost

No cost. This script only reads existing resources.

## Related docs

- [AWS CLI ec2 reference](https://docs.aws.amazon.com/cli/latest/reference/ec2/index.html)

8 changes: 8 additions & 0 deletions tuts/184-ec2-ebs-volume-types/REVISION-HISTORY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Revision History: 184-ec2-ebs-volume-types

## Shell (CLI script)

### 2026-04-14 v1 published
- Type: functional
- Initial version

19 changes: 19 additions & 0 deletions tuts/184-ec2-ebs-volume-types/ec2-ebs-types.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Ec2 Ebs Types

## Prerequisites

1. AWS CLI installed and configured (`aws configure`)
2. Appropriate IAM permissions for the AWS services used

## Step 1: Listing EBS volume types

The script handles this step automatically. See `ec2-ebs-types.sh` for the exact CLI commands.

## Step 2: Listing your volumes by type

The script handles this step automatically. See `ec2-ebs-types.sh` for the exact CLI commands.

## Step 3: Describing volume modifications

The script handles this step automatically. See `ec2-ebs-types.sh` for the exact CLI commands.

15 changes: 15 additions & 0 deletions tuts/184-ec2-ebs-volume-types/ec2-ebs-types.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash
WORK_DIR=$(mktemp -d); exec > >(tee -a "$WORK_DIR/tut.log") 2>&1
REGION=${AWS_DEFAULT_REGION:-${AWS_REGION:-$(aws configure get region 2>/dev/null))}; [ -z "$REGION" ] && echo "ERROR: No region" && exit 1; export AWS_DEFAULT_REGION="$REGION"; echo "Region: $REGION"
echo "Step 1: Listing EBS volume types"
echo " gp3: General Purpose SSD (default)"
echo " gp2: Previous gen General Purpose SSD"
echo " io2: Provisioned IOPS SSD"
echo " st1: Throughput Optimized HDD"
echo " sc1: Cold HDD"
echo "Step 2: Listing your volumes by type"
aws ec2 describe-volumes --query "Volumes[].{Id:VolumeId,Type:VolumeType,Size:Size,State:State,IOPS:Iops}" --output table 2>/dev/null || echo " No volumes"
echo "Step 3: Describing volume modifications"
aws ec2 describe-volumes-modifications --query "VolumesModifications[:5].{Id:VolumeId,Status:ModificationState,OrigType:OriginalVolumeType,TargetType:TargetVolumeType}" --output table 2>/dev/null || echo " No modifications"
echo ""; echo "Tutorial complete. No resources created — read-only."
rm -rf "$WORK_DIR"
40 changes: 40 additions & 0 deletions tuts/185-lambda-dead-letter-queue/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Lambda Dead Letter

An AWS CLI tutorial that demonstrates Iam operations.

## Running

```bash
bash lambda-dead-letter.sh
```

To auto-run with cleanup:

```bash
echo 'y' | bash lambda-dead-letter.sh
```

## What it does

1. Creating function that always fails
2. Invoking async (will fail and go to DLQ)
3. Checking DLQ (after retries, ~3 min)

## Resources created

- Function
- Queue
- Role

The script prompts you to clean up resources when it finishes.

## Cost

Free tier eligible for most operations. Clean up resources after use to avoid charges.

## Related docs

- [AWS CLI iam reference](https://docs.aws.amazon.com/cli/latest/reference/iam/index.html)
- [AWS CLI lambda reference](https://docs.aws.amazon.com/cli/latest/reference/lambda/index.html)
- [AWS CLI sqs reference](https://docs.aws.amazon.com/cli/latest/reference/sqs/index.html)

8 changes: 8 additions & 0 deletions tuts/185-lambda-dead-letter-queue/REVISION-HISTORY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Revision History: 185-lambda-dead-letter-queue

## Shell (CLI script)

### 2026-04-14 v1 published
- Type: functional
- Initial version

23 changes: 23 additions & 0 deletions tuts/185-lambda-dead-letter-queue/lambda-dead-letter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Lambda Dead Letter

## Prerequisites

1. AWS CLI installed and configured (`aws configure`)
2. Appropriate IAM permissions for the AWS services used

## Step 1: Creating function that always fails

The script handles this step automatically. See `lambda-dead-letter.sh` for the exact CLI commands.

## Step 2: Invoking async (will fail and go to DLQ)

The script handles this step automatically. See `lambda-dead-letter.sh` for the exact CLI commands.

## Step 3: Checking DLQ (after retries, ~3 min)

The script handles this step automatically. See `lambda-dead-letter.sh` for the exact CLI commands.

## Cleanup

The script prompts you to clean up all created resources. If you need to clean up manually, check the script log for the resource names that were created.

25 changes: 25 additions & 0 deletions tuts/185-lambda-dead-letter-queue/lambda-dead-letter.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash
WORK_DIR=$(mktemp -d); exec > >(tee -a "$WORK_DIR/tut.log") 2>&1
REGION=${AWS_DEFAULT_REGION:-${AWS_REGION:-$(aws configure get region 2>/dev/null))}; [ -z "$REGION" ] && echo "ERROR: No region" && exit 1; export AWS_DEFAULT_REGION="$REGION"; echo "Region: $REGION"
RANDOM_ID=$(cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 8 | head -n 1); F="dlq-func-${RANDOM_ID}"; R="dlq-func-role-${RANDOM_ID}"; Q="dlq-func-q-${RANDOM_ID}"
handle_error() { echo "ERROR on line $1"; trap - ERR; cleanup; exit 1; }; trap 'handle_error $LINENO' ERR
cleanup() { echo "Cleaning up..."; aws lambda delete-function --function-name "$F" 2>/dev/null; [ -n "$QU" ] && aws sqs delete-queue --queue-url "$QU" 2>/dev/null; aws iam detach-role-policy --role-name "$R" --policy-arn arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole 2>/dev/null; aws iam detach-role-policy --role-name "$R" --policy-arn arn:aws:iam::aws:policy/AmazonSQSFullAccess 2>/dev/null; aws iam delete-role --role-name "$R" 2>/dev/null; rm -rf "$WORK_DIR"; echo "Done."; }
RA=$(aws iam create-role --role-name "$R" --assume-role-policy-document '{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Principal":{"Service":"lambda.amazonaws.com"},"Action":"sts:AssumeRole"}]}' --query Role.Arn --output text)
aws iam attach-role-policy --role-name "$R" --policy-arn arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole
aws iam attach-role-policy --role-name "$R" --policy-arn arn:aws:iam::aws:policy/AmazonSQSFullAccess; sleep 10
QU=$(aws sqs create-queue --queue-name "$Q" --query QueueUrl --output text)
QA=$(aws sqs get-queue-attributes --queue-url "$QU" --attribute-names QueueArn --query Attributes.QueueArn --output text)
echo "Step 1: Creating function that always fails"
echo "def handler(e,c): raise Exception('Intentional failure')" > "$WORK_DIR/i.py"
(cd "$WORK_DIR" && zip f.zip i.py > /dev/null)
aws lambda create-function --function-name "$F" --zip-file "fileb://$WORK_DIR/f.zip" --handler i.handler --runtime python3.12 --role "$RA" --dead-letter-config "{\"TargetArn\":\"$QA\"}" --architectures x86_64 > /dev/null
aws lambda wait function-active-v2 --function-name "$F"
echo " Function with DLQ configured"
echo "Step 2: Invoking async (will fail and go to DLQ)"
aws lambda invoke --function-name "$F" --invocation-type Event --cli-binary-format raw-in-base64-out --payload '{}' "$WORK_DIR/out.json" > /dev/null
echo " Invoked async — Lambda will retry twice then send to DLQ"
echo "Step 3: Checking DLQ (after retries, ~3 min)"
echo " DLQ messages: $(aws sqs get-queue-attributes --queue-url "$QU" --attribute-names ApproximateNumberOfMessages --query Attributes.ApproximateNumberOfMessages --output text)"
echo " (Message will appear after Lambda exhausts retries)"
echo ""; echo "Tutorial complete."
echo "Do you want to clean up? (y/n): "; read -r C; [[ "$C" =~ ^[Yy]$ ]] && cleanup
28 changes: 28 additions & 0 deletions tuts/187-ec2-instance-types/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Ec2 Instance Types

A read-only script that queries Ec2 resources and displays information.

## Running

```bash
bash ec2-instance-types.sh
```

## What it does

1. Listing instance type families
2. Describing a specific type
3. Finding instances by criteria

## Resources created

None — this script is read-only.

## Cost

No cost. This script only reads existing resources.

## Related docs

- [AWS CLI ec2 reference](https://docs.aws.amazon.com/cli/latest/reference/ec2/index.html)

8 changes: 8 additions & 0 deletions tuts/187-ec2-instance-types/REVISION-HISTORY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Revision History: 187-ec2-instance-types

## Shell (CLI script)

### 2026-04-14 v1 published
- Type: functional
- Initial version

19 changes: 19 additions & 0 deletions tuts/187-ec2-instance-types/ec2-instance-types.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Ec2 Instance Types

## Prerequisites

1. AWS CLI installed and configured (`aws configure`)
2. Appropriate IAM permissions for the AWS services used

## Step 1: Listing instance type families

The script handles this step automatically. See `ec2-instance-types.sh` for the exact CLI commands.

## Step 2: Describing a specific type

The script handles this step automatically. See `ec2-instance-types.sh` for the exact CLI commands.

## Step 3: Finding instances by criteria

The script handles this step automatically. See `ec2-instance-types.sh` for the exact CLI commands.

11 changes: 11 additions & 0 deletions tuts/187-ec2-instance-types/ec2-instance-types.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash
WORK_DIR=$(mktemp -d); exec > >(tee -a "$WORK_DIR/tut.log") 2>&1
REGION=${AWS_DEFAULT_REGION:-${AWS_REGION:-$(aws configure get region 2>/dev/null))}; [ -z "$REGION" ] && echo "ERROR: No region" && exit 1; export AWS_DEFAULT_REGION="$REGION"; echo "Region: $REGION"
echo "Step 1: Listing instance type families"
aws ec2 describe-instance-types --filters "Name=instance-type,Values=t3.*" --query 'InstanceTypes[].{Type:InstanceType,vCPUs:VCpuInfo.DefaultVCpus,Memory:MemoryInfo.SizeInMiB}' --output table
echo "Step 2: Describing a specific type"
aws ec2 describe-instance-types --instance-types t3.micro --query 'InstanceTypes[0].{Type:InstanceType,vCPUs:VCpuInfo.DefaultVCpus,Memory:MemoryInfo.SizeInMiB,Network:NetworkInfo.NetworkPerformance,Arch:ProcessorInfo.SupportedArchitectures}' --output table
echo "Step 3: Finding instances by criteria"
aws ec2 describe-instance-types --filters "Name=vcpu-info.default-vcpus,Values=2" "Name=memory-info.size-in-mib,Values=4096" --query 'InstanceTypes[:5].{Type:InstanceType,vCPUs:VCpuInfo.DefaultVCpus,Memory:MemoryInfo.SizeInMiB}' --output table
echo ""; echo "Tutorial complete. No resources created — read-only."
rm -rf "$WORK_DIR"
29 changes: 29 additions & 0 deletions tuts/192-lambda-runtimes-and-quotas/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Lambda Container

A read-only script that queries Lambda resources and displays information.

## Running

```bash
bash lambda-container.sh
```

## What it does

1. Listing Lambda runtimes
2. Getting Lambda service quotas
3. Listing functions by runtime
4. Listing event source mappings

## Resources created

None — this script is read-only.

## Cost

No cost. This script only reads existing resources.

## Related docs

- [AWS CLI lambda reference](https://docs.aws.amazon.com/cli/latest/reference/lambda/index.html)

8 changes: 8 additions & 0 deletions tuts/192-lambda-runtimes-and-quotas/REVISION-HISTORY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Revision History: 192-lambda-runtimes-and-quotas

## Shell (CLI script)

### 2026-04-14 v1 published
- Type: functional
- Initial version

23 changes: 23 additions & 0 deletions tuts/192-lambda-runtimes-and-quotas/lambda-container.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Lambda Container

## Prerequisites

1. AWS CLI installed and configured (`aws configure`)
2. Appropriate IAM permissions for the AWS services used

## Step 1: Listing Lambda runtimes

The script handles this step automatically. See `lambda-container.sh` for the exact CLI commands.

## Step 2: Getting Lambda service quotas

The script handles this step automatically. See `lambda-container.sh` for the exact CLI commands.

## Step 3: Listing functions by runtime

The script handles this step automatically. See `lambda-container.sh` for the exact CLI commands.

## Step 4: Listing event source mappings

The script handles this step automatically. See `lambda-container.sh` for the exact CLI commands.

13 changes: 13 additions & 0 deletions tuts/192-lambda-runtimes-and-quotas/lambda-container.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash
WORK_DIR=$(mktemp -d); exec > >(tee -a "$WORK_DIR/tut.log") 2>&1
REGION=${AWS_DEFAULT_REGION:-${AWS_REGION:-$(aws configure get region 2>/dev/null))}; [ -z "$REGION" ] && echo "ERROR: No region" && exit 1; export AWS_DEFAULT_REGION="$REGION"; echo "Region: $REGION"
echo "Step 1: Listing Lambda runtimes"
aws lambda list-layers --compatible-runtime python3.12 --query 'Layers[:5].{Name:LayerName,Version:LatestMatchingVersion.Version}' --output table 2>/dev/null || echo " No compatible layers"
echo "Step 2: Getting Lambda service quotas"
aws lambda get-account-settings --query 'AccountLimit.{CodeSize:TotalCodeSize,ConcurrentExec:ConcurrentExecutions,FunctionCount:FunctionCount}' --output table
echo "Step 3: Listing functions by runtime"
aws lambda list-functions --query 'Functions[?Runtime==`python3.12`][:5].{Name:FunctionName,Runtime:Runtime,Size:CodeSize}' --output table 2>/dev/null || echo " No Python 3.12 functions"
echo "Step 4: Listing event source mappings"
aws lambda list-event-source-mappings --query 'EventSourceMappings[:5].{Function:FunctionArn,Source:EventSourceArn,State:State}' --output table 2>/dev/null || echo " No event source mappings"
echo ""; echo "Tutorial complete. No resources created — read-only."
rm -rf "$WORK_DIR"
29 changes: 29 additions & 0 deletions tuts/193-ec2-regions-and-zones/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Ec2 Metadata

A read-only script that queries Ec2 resources and displays information.

## Running

```bash
bash ec2-metadata.sh
```

## What it does

1. Describing your running instances
2. Describing instance status
3. Listing regions
4. Listing availability zones

## Resources created

None — this script is read-only.

## Cost

No cost. This script only reads existing resources.

## Related docs

- [AWS CLI ec2 reference](https://docs.aws.amazon.com/cli/latest/reference/ec2/index.html)

8 changes: 8 additions & 0 deletions tuts/193-ec2-regions-and-zones/REVISION-HISTORY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Revision History: 193-ec2-regions-and-zones

## Shell (CLI script)

### 2026-04-14 v1 published
- Type: functional
- Initial version

23 changes: 23 additions & 0 deletions tuts/193-ec2-regions-and-zones/ec2-metadata.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Ec2 Metadata

## Prerequisites

1. AWS CLI installed and configured (`aws configure`)
2. Appropriate IAM permissions for the AWS services used

## Step 1: Describing your running instances

The script handles this step automatically. See `ec2-metadata.sh` for the exact CLI commands.

## Step 2: Describing instance status

The script handles this step automatically. See `ec2-metadata.sh` for the exact CLI commands.

## Step 3: Listing regions

The script handles this step automatically. See `ec2-metadata.sh` for the exact CLI commands.

## Step 4: Listing availability zones

The script handles this step automatically. See `ec2-metadata.sh` for the exact CLI commands.

13 changes: 13 additions & 0 deletions tuts/193-ec2-regions-and-zones/ec2-metadata.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash
WORK_DIR=$(mktemp -d); exec > >(tee -a "$WORK_DIR/tut.log") 2>&1
REGION=${AWS_DEFAULT_REGION:-${AWS_REGION:-$(aws configure get region 2>/dev/null))}; [ -z "$REGION" ] && echo "ERROR: No region" && exit 1; export AWS_DEFAULT_REGION="$REGION"; echo "Region: $REGION"
echo "Step 1: Describing your running instances"
aws ec2 describe-instances --filters "Name=instance-state-name,Values=running" --query 'Reservations[].Instances[:3].{Id:InstanceId,Type:InstanceType,State:State.Name,AZ:Placement.AvailabilityZone}' --output table 2>/dev/null || echo " No running instances"
echo "Step 2: Describing instance status"
aws ec2 describe-instance-status --query 'InstanceStatuses[:3].{Id:InstanceId,System:SystemStatus.Status,Instance:InstanceStatus.Status}' --output table 2>/dev/null || echo " No instance status"
echo "Step 3: Listing regions"
aws ec2 describe-regions --query 'Regions[:10].{Name:RegionName,Endpoint:Endpoint}' --output table
echo "Step 4: Listing availability zones"
aws ec2 describe-availability-zones --query 'AvailabilityZones[:5].{Zone:ZoneName,State:State,Type:ZoneType}' --output table
echo ""; echo "Tutorial complete. No resources created — read-only."
rm -rf "$WORK_DIR"
Loading