AWS IAM Policy Simulator with Terraform: Test Permissions Before Deploying
Use the AWS IAM Policy Simulator — also known as an IAM policy tester — to validate Terraform policies before apply and catch AccessDenied errors.
DevOps
Provision macOS CI build infrastructure with Terraform: EC2 Mac instances (mac1, mac2-m2pro), dedicated hosts, and self-hosted GitHub Actions runners.
macOS CI infrastructure is one of the few cases where Terraform meets Apple silicon. EC2 Mac instances (mac1.metal, mac2.metal, mac2-m2.metal, mac2-m2pro.metal) run real Apple hardware in AWS data centers, on a 24-hour minimum dedicated host allocation. iOS/macOS apps need them to build and codesign. Terraform provisions the dedicated hosts and instances; an autoscaling group of Linux runners can't replace them.
resource "aws_ec2_host" "mac" {
instance_type = "mac2-m2pro.metal"
availability_zone = "us-east-1a"
auto_placement = "on"
}
resource "aws_instance" "mac_runner" {
ami = data.aws_ami.macos_sonoma.id
instance_type = "mac2-m2pro.metal"
host_id = aws_ec2_host.mac.id
tenancy = "host"
root_block_device {
volume_size = 500
volume_type = "gp3"
iops = 6000
throughput = 500
}
tags = { Name = "mac-runner-1" }
}data "aws_ami" "macos_sonoma" {
most_recent = true
owners = ["amazon"]
filter {
name = "name"
values = ["amzn-ec2-macos-14.*"]
}
filter {
name = "architecture"
values = ["arm64_mac"]
}
}resource "aws_instance" "mac_runner" {
ami = data.aws_ami.macos_sonoma.id
instance_type = "mac2-m2pro.metal"
host_id = aws_ec2_host.mac.id
tenancy = "host"
key_name = aws_key_pair.mac.key_name
user_data = base64encode(<<-EOT
#!/bin/bash
set -euxo pipefail
sudo -u ec2-user -i <<'EOF'
set -euxo pipefail
cd ~
mkdir -p actions-runner && cd actions-runner
curl -o runner.tar.gz -L https://github.com/actions/runner/releases/download/v2.319.1/actions-runner-osx-arm64-2.319.1.tar.gz
tar xzf runner.tar.gz
./config.sh \
--url https://github.com/${var.gh_org}/${var.gh_repo} \
--token ${var.gh_runner_token} \
--labels self-hosted,macos,arm64 \
--unattended
./svc.sh install
./svc.sh start
EOF
EOT
)
tags = { Name = "gha-mac-runner-1", role = "ci" }
}aws_ssm_document to schedule.resource "aws_ssm_document" "mac_reset" {
name = "mac-reset"
document_type = "Command"
content = jsonencode({
schemaVersion = "2.2"
mainSteps = [{
action = "aws:runShellScript"
name = "reset"
inputs = {
runCommand = [
"rm -rf /Users/ec2-user/work/*",
"rm -rf /Users/ec2-user/Library/Developer/Xcode/DerivedData/*",
"xcrun simctl erase all || true"
]
}
}]
})
}mac2-m2pro) and the 24 h floor punishes elasticity.team, repo, xcode_version — this fleet is the most expensive line item in many CI bills.Use the AWS IAM Policy Simulator — also known as an IAM policy tester — to validate Terraform policies before apply and catch AccessDenied errors.
Deploy real infrastructure on AWS Free Tier with Terraform. Includes EC2, S3, RDS, Lambda, and DynamoDB examples — all within free tier limits. No charges if you follow this guide.
Deploy OpenClaw AI on AWS EC2 with Terraform: Ubuntu 24.04, gp3 EBS for persistent agent data, SSH key pair, security group, and user-data bootstrap.
Provision multiplayer game server backends with Terraform: AWS GameLift fleets, FlexMatch matchmaking, queues, and player session APIs.