Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
4c6c4a4
Add 12 Papi-generated tutorials: tested and passing
mwunderl May 13, 2026
c00c502
Add 8 more tutorials: enhanced pipeline (examples + full specs) = 100…
mwunderl May 13, 2026
fda87b5
Add CLI bash scripts for 4 services (Route 53, GuardDuty, Amplify, Co…
mwunderl May 13, 2026
1e7e20c
Add 5 more CLI scripts: rbin, sesv2, pinpoint, transcribe, scheduler …
mwunderl May 13, 2026
277c3b6
Add 5 more CLI scripts (codeartifact, accessanalyzer, firehose, sesv2…
mwunderl May 13, 2026
e25d23c
Fix rbin CLI script: now creates/updates/deletes rule
mwunderl May 14, 2026
ddbd1c3
Add 12 more CLI scripts to PR #82 (codebuild, codecommit, codepipelin…
mwunderl May 14, 2026
b06a2ac
Refine 12 CLI scripts: add error handling, resource tracking, cleanup
mwunderl May 14, 2026
1772885
Fix 4 more CLI scripts: organizations, codebuild, inspector2, sdb
mwunderl May 14, 2026
5959622
Fix codeartifact: sleep 10 for domain propagation
mwunderl May 15, 2026
674a29d
Instructive CLI scripts: 2-3 sentence explanations before each step
mwunderl May 15, 2026
3c9321d
Add tutorial markdown for all 16 services in PR #82
mwunderl May 15, 2026
2e9786a
Add resource tagging to all 16 CLI scripts (project=doc-smith, tutori…
mwunderl May 15, 2026
36f6e5f
Add resource tagging to all 20 Python scripts (project=doc-smith, tut…
mwunderl May 15, 2026
6df6966
Remove 4 incomplete tutorials, renumber remaining 16 to 088-103
mwunderl May 19, 2026
9c2198c
Remove internal references: replace hardcoded ARNs with env vars, add…
mwunderl May 19, 2026
b2e151d
Remove log files with internal resource references
mwunderl May 19, 2026
063728a
Fix transcribe: use inline Phrases instead of S3 bucket placeholder
mwunderl May 19, 2026
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
90 changes: 90 additions & 0 deletions tuts/000-prereqs-roles/cfn-prereqs-roles.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
AWSTemplateFormatVersion: '2010-09-09'
Description: IAM roles for tutorial scripts
Resources:
SchedulerRole:
Type: AWS::IAM::Role
Properties:
RoleName: tutorial-scheduler-role
AssumeRolePolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: Allow
Principal:
Service: scheduler.amazonaws.com
Action: sts:AssumeRole
Policies:
- PolicyName: SchedulerAccess
PolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: Allow
Action: ['sqs:SendMessage', 'sns:Publish', 'lambda:InvokeFunction']
Resource: '*'
FirehoseRole:
Type: AWS::IAM::Role
Properties:
RoleName: tutorial-firehose-role
AssumeRolePolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: Allow
Principal:
Service: firehose.amazonaws.com
Action: sts:AssumeRole
Policies:
- PolicyName: FirehoseAccess
PolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: Allow
Action: ['s3:PutObject', 's3:GetBucketLocation', 's3:ListBucket']
Resource: '*'
CodeBuildRole:
Type: AWS::IAM::Role
Properties:
RoleName: tutorial-codebuild-role
AssumeRolePolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: Allow
Principal:
Service: codebuild.amazonaws.com
Action: sts:AssumeRole
ManagedPolicyArns:
- arn:aws:iam::aws:policy/CloudWatchLogsFullAccess
CodePipelineRole:
Type: AWS::IAM::Role
Properties:
RoleName: tutorial-codepipeline-role
AssumeRolePolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: Allow
Principal:
Service: codepipeline.amazonaws.com
Action: sts:AssumeRole
Policies:
- PolicyName: PipelineAccess
PolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: Allow
Action: ['s3:*', 'codebuild:*']
Resource: '*'
Outputs:
SchedulerRoleArn:
Value: !GetAtt SchedulerRole.Arn
Export:
Name: tutorial-scheduler-role-arn
FirehoseRoleArn:
Value: !GetAtt FirehoseRole.Arn
Export:
Name: tutorial-firehose-role-arn
CodeBuildRoleArn:
Value: !GetAtt CodeBuildRole.Arn
Export:
Name: tutorial-codebuild-role-arn
CodePipelineRoleArn:
Value: !GetAtt CodePipelineRole.Arn
Export:
Name: tutorial-codepipeline-role-arn
24 changes: 24 additions & 0 deletions tuts/088-scheduler-gs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# EventBridge Scheduler Getting Started

Create a scheduled task that invokes an SQS queue on a cron expression

## Prerequisites

- AWS CLI configured with credentials
- Python 3.8+ with boto3 installed
- Sufficient IAM permissions for scheduler

## Run

```bash
python3 scheduler-gs-gs.py
```

## Resources Created

This script creates resources, demonstrates their use, and cleans up automatically.
No manual cleanup required.

## Generated

This tutorial was automatically generated and tested.
72 changes: 72 additions & 0 deletions tuts/088-scheduler-gs/scheduler-gs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
import boto3
import time

region = 'us-east-1'
import os, sys
ROLE_ARN = os.environ.get('TUTORIAL_ROLE_ARN') or (sys.argv[1] if len(sys.argv) > 1 else None)
if not ROLE_ARN:
print('Usage: python3 script.py <role-arn>')
print('Or set TUTORIAL_ROLE_ARN environment variable')
print('Create the role with: aws cloudformation deploy --template-file prereqs.yaml --stack-name tutorial-prereqs --capabilities CAPABILITY_NAMED_IAM')
sys.exit(1)
suffix = str(int(time.time()))[-6:]
scheduler = boto3.client('scheduler', region_name=region)

def create_schedule_group(name):
try:
response = scheduler.create_schedule_group(Name=name, Tags=[{'Key':'project','Value':'doc-smith'},{'Key':'tutorial','Value':'scheduler-gs'}])
print(f"Created Schedule Group: {name}")
return response['ScheduleGroupArn']
except Exception as e:
print(f"Error creating schedule group: {e}")
raise

def create_schedule(group_arn, name):
try:
response = scheduler.create_schedule(
Name=name,
ScheduleExpression='rate(5 minutes)',
Target= {
'Arn': iam_ROLE_ARN,
'RoleArn': iam_ROLE_ARN
},
ScheduleExpressionTimezone='America/New_York',
State='ENABLED',
ScheduleGroupName=group_arn.split(':')[-1],
Tags=[{'Key':'project','Value':'doc-smith'},{'Key':'tutorial','Value':'scheduler-gs'}]
)
print(f"Created Schedule: {name}")
return response['ScheduleArn']
except Exception as e:
print(f"Error creating schedule: {e}")
raise

def delete_schedule(arn):
try:
scheduler.delete_schedule(Name=arn.split(':')[-1], ScheduleGroup=arn.split(':')[-2])
print(f"Deleted Schedule: {arn}")
except Exception as e:
print(f"Error deleting schedule: {e}")
raise

def delete_schedule_group(arn):
try:
scheduler.delete_schedule_group(Name=arn.split(':')[-1])
print(f"Deleted Schedule Group: {arn}")
except Exception as e:
print(f"Error deleting schedule group: {e}")
raise

try:
group_name = f'group-{suffix}'
schedule_name = f'schedule-{suffix}'

group_arn = create_schedule_group(group_name)
schedule_arn = create_schedule(group_arn, schedule_name)

delete_schedule(schedule_arn)
delete_schedule_group(group_arn)

print("PASS")
except Exception as e:
print(f"Script failed: {e}")
73 changes: 73 additions & 0 deletions tuts/088-scheduler-gs/scheduler-gs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
#!/bin/bash
set -e
echo "=== AWS Scheduler Service Tutorial ==="
echo "This tutorial demonstrates how to create, list, and delete schedule groups and schedules using the AWS Scheduler service."

REGION='us-east-1'
SUFFIX=$(head -c 20 /dev/urandom | base64 | tr -dc a-z0-9 | head -c 8 || true)
TEMP_DIR=$(mktemp -d)
LOG_FILE="${TEMP_DIR}/log.txt"
declare -a CREATED_RESOURCES=()

cleanup_resources() {
for (( i=${#CREATED_RESOURCES[@]}-1; i>=0; i-- )); do
RESOURCE=(${CREATED_RESOURCES[$i]})
case ${RESOURCE[0]} in
"group")
aws scheduler delete-schedule-group --name ${RESOURCE[1]} || true
;;
"schedule")
aws scheduler delete-schedule --name ${RESOURCE[1]} || true
;;
esac
done
rm -rf ${TEMP_DIR}
}
trap cleanup_resources EXIT

if [ -t 1 ]; then
REGION="${AWS_DEFAULT_REGION:-us-east-1}"
exit 1
fi

echo "=== Step 1: Verify AWS CLI Configuration ==="
echo "Checking if the AWS CLI is configured with the correct region."
echo "This ensures that all operations are performed in the intended AWS region."
echo ""
REGION="${AWS_DEFAULT_REGION:-us-east-1}"
echo "AWS CLI is configured with region ${REGION}."
echo ""

echo "=== Step 2: Create Schedule Group ==="
echo "Creating a schedule group is the first step in organizing your schedules."
echo "A schedule group helps in managing and categorizing related schedules."
echo ""
GROUP_NAME="group-${SUFFIX}"
echo "Creating schedule group: ${GROUP_NAME}"
GROUP_ARN=$(aws scheduler create-schedule-group --name ${GROUP_NAME} --tags Key=project,Value=doc-smith Key=tutorial,Value=scheduler-gs --query 'ScheduleGroupArn' --output text)
echo "Schedule group created: ${GROUP_ARN}"
CREATED_RESOURCES+=("group:${GROUP_NAME}")
echo ""

echo "=== Step 3: Create Schedule ==="
echo "Creating a schedule allows you to define when and how often a task should run."
echo "This is crucial for automating repetitive tasks in your AWS environment."
echo ""
SCHEDULE_NAME="schedule-${SUFFIX}"
echo "Creating schedule: ${SCHEDULE_NAME}"
SCHEDULE_ARN=$(aws scheduler create-schedule --name ${SCHEDULE_NAME} --schedule-expression 'rate(5 minutes)' --target '{"Arn": "arn:aws:lambda:us-east-1:123456789012:function:MyFunction", "RoleArn": "${TUTORIAL_ROLE_ARN:?Set TUTORIAL_ROLE_ARN}"}' --flexible-time-window '{"Mode": "OFF"}' --tags Key=project,Value=doc-smith Key=tutorial,Value=scheduler-gs --query 'ScheduleArn' --output text)
echo "Schedule created: ${SCHEDULE_ARN}"
CREATED_RESOURCES+=("schedule:${SCHEDULE_NAME}")
echo ""

echo "=== Step 4: List Schedule Groups ==="
echo "Listing schedule groups helps you keep track of all the groups you have created."
echo "This is useful for managing and auditing your schedule groups."
echo ""
echo "Listing schedule groups:"
aws scheduler list-schedule-groups --query 'ScheduleGroups[].Name' --output text
echo ""

echo "=== Tutorial Complete ==="
echo "In this tutorial, you learned how to create a schedule group and a schedule using the AWS Scheduler service."
echo "You also learned how to list schedule groups."
110 changes: 110 additions & 0 deletions tuts/088-scheduler-gs/scheduler-tutorial.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
# AWS Scheduler Service Tutorial

This tutorial demonstrates how to create, list, and delete schedule groups and schedules using the AWS Scheduler service.

## Topics

- [Prerequisites](#aws-scheduler-service-tutorial-prerequisites)
- [Verify AWS CLI Configuration](#aws-scheduler-service-tutorial-verify-aws-cli-configuration)
- [Create Schedule Group](#aws-scheduler-service-tutorial-create-schedule-group)
- [Create Schedule](#aws-scheduler-service-tutorial-create-schedule)
- [List Schedule Groups](#aws-scheduler-service-tutorial-list-schedule-groups)
- [Clean up resources](#aws-scheduler-service-tutorial-clean-up-resources)
- [Next steps](#aws-scheduler-service-tutorial-next-steps)

## Prerequisites

Before you begin this tutorial, make sure you have the following.

1. The AWS CLI. If you need to install it, follow the [AWS CLI installation guide](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html). You can also [use AWS CloudShell](https://docs.aws.amazon.com/cloudshell/latest/userguide/what-is-cloudshell.html), which includes the AWS CLI.
2. Configured your AWS CLI with appropriate credentials. Run `aws configure` if you haven't set up your credentials yet.
3. Basic familiarity with command line interfaces.
4. [Sufficient permissions](https://docs.aws.amazon.com/scheduler/latest/UserGuide/security_iam_id-based-policy-examples.html) to create, list, and delete schedule groups and schedules.

## Verify AWS CLI Configuration

Checking if the AWS CLI is configured with the correct region. This ensures that all operations are performed in the intended AWS region.

**Checking AWS CLI configuration:**

```bash
REGION="${AWS_DEFAULT_REGION:-us-east-1}"
echo "AWS CLI is configured with region ${REGION}."
```

After running the command, ensure that the region displayed matches your intended AWS region.

## Create Schedule Group

Creating a schedule group is the first step in organizing your schedules. A schedule group helps in managing and categorizing related schedules.

**Creating a schedule group:**

```bash
GROUP_NAME="group-$(head -c 20 /dev/urandom | base64 | tr -dc a-z0-9 | head -c 8 || true)"
echo "Creating schedule group: ${GROUP_NAME}"
GROUP_ARN=$(aws scheduler create-schedule-group --name ${GROUP_NAME} --query 'ScheduleGroupArn' --output text)
echo "Schedule group created: ${GROUP_ARN}"
```

After running the command, you should see the ARN of the created schedule group.

## Create Schedule

Creating a schedule allows you to define when and how often a task should run. This is crucial for automating repetitive tasks in your AWS environment.

**Creating a schedule:**

```bash
SCHEDULE_NAME="schedule-$(head -c 20 /dev/urandom | base64 | tr -dc a-z0-9 | head -c 8 || true)"
echo "Creating schedule: ${SCHEDULE_NAME}"
SCHEDULE_ARN=$(aws scheduler create-schedule --name ${SCHEDULE_NAME} --schedule-expression 'rate(5 minutes)' --target '{"Arn": "arn:aws:lambda:us-east-1:123456789012:function:MyFunction", "RoleArn": "arn:aws:iam::123456789012:role/tutorial-scheduler-role"}' --flexible-time-window '{"Mode": "OFF"}' --query 'ScheduleArn' --output text)
echo "Schedule created: ${SCHEDULE_ARN}"
```

After running the command, you should see the ARN of the created schedule.

## List Schedule Groups

Listing schedule groups helps you keep track of all the groups you have created. This is useful for managing and auditing your schedule groups.

**Listing schedule groups:**

```bash
echo "Listing schedule groups:"
aws scheduler list-schedule-groups --query 'ScheduleGroups[].Name' --output text
```

After running the command, you should see a list of all schedule groups you have created.

## Clean up resources

To clean up the resources created during this tutorial, the script includes a cleanup function that deletes the schedule group and schedule.

**Cleaning up resources:**

```bash
cleanup_resources() {
for (( i=${#CREATED_RESOURCES[@]}-1; i>=0; i-- )); do
RESOURCE=(${CREATED_RESOURCES[$i]})
case ${RESOURCE[0]} in
"group")
aws scheduler delete-schedule-group --name ${RESOURCE[1]} || true
;;
"schedule")
aws scheduler delete-schedule --name ${RESOURCE[1]} || true
;;
esac
done
rm -rf ${TEMP_DIR}
}
trap cleanup_resources EXIT
```

This ensures that all created resources are deleted when the script exits.

## Next steps

- Learn more about [managing schedule groups](https://docs.aws.amazon.com/scheduler/latest/UserGuide/managing-schedule-groups.html).
- Explore how to [create and manage schedules](https://docs.aws.amazon.com/scheduler/latest/UserGuide/managing-schedules.html).
- Understand [IAM permissions for AWS Scheduler](https://docs.aws.amazon.com/scheduler/latest/UserGuide/security_iam_id-based-policy-examples.html).
Loading
Loading