/iac-automation-skills:aws-cloudformation-templatesfrom iac-automation-skills
Authors and operates AWS CloudFormation templates: stacks, change sets, nested/cross-stack references, StackSets, and drift detection. Use for AWS-native IaC or comparing with Terraform.
Ships in iac-automation-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
CloudFormation is AWS's native infrastructure-as-code service: it declares AWS resources in a YAML/JSON template, and AWS itself manages the create/ update/delete lifecycle as a stack, tracking resource state server-side (no separate state file to store or lock). That server-side state is also the main operational tradeoff versus a tool like Terraform — see infrastructure-as-code-terraform for the general "why IaC" case and Terraform's plan/state/module model. CloudFormation trades Terraform's multi-cloud portability and local plan files for deep native integration: no state backend to configure, native rollback on failed updates, IAM-scoped stack permissions, and StackSets for governed multi-account/multi-region rollout. Choose CloudFormation when the workload is AWS-only and you want AWS to own the state and rollback semantics; choose Terraform when you need multi-cloud consistency, a richer module ecosystem, or a plan file reviewable outside the AWS console/CLI.
cloudformation:*
actions needed (CreateStack, CreateChangeSet, ExecuteChangeSet,
DescribeStacks, DetectStackDrift, etc.) plus permissions for every
resource type the template provisions — CloudFormation executes as the
calling principal by default, or as a dedicated service role if one
is attached to the stack (recommended for least-privilege separation
between "who can request a change" and "what the change is allowed to
touch").!Ref/!Sub); JSON is
fully equivalent and sometimes preferred for machine generation.cfn-lint installed for static template validation before any AWS call.AWSCloudFormationStackSetAdministrationRole
/ AWSCloudFormationStackSetExecutionRole) pre-provisioned in target
accounts for the self-managed permission model.CAPABILITY_IAM / CAPABILITY_NAMED_IAM (template creates IAM
resources) and CAPABILITY_AUTO_EXPAND (template uses macros/nested
transforms such as SAM) — deployments fail fast without these being
explicitly passed, which is intentional friction so IAM-creating
templates aren't applied unreviewed.Author the template with parameters, not hardcoded values, so the same template is reusable across environments:
AWSTemplateFormatVersion: "2010-09-09"
Description: Application logging bucket with lifecycle policy
Parameters:
EnvironmentName:
Type: String
AllowedValues: [dev, staging, prod]
RetentionInDays:
Type: Number
Default: 90
Resources:
LogsBucket:
Type: AWS::S3::Bucket
Properties:
BucketName: !Sub "example-app-logs-${EnvironmentName}"
LifecycleConfiguration:
Rules:
- Id: expire-logs
Status: Enabled
ExpirationInDays: !Ref RetentionInDays
Outputs:
BucketArn:
Value: !GetAtt LogsBucket.Arn
Export:
Name: !Sub "${EnvironmentName}-app-logs-bucket-arn"
The Export makes BucketArn consumable by other stacks via
Fn::ImportValue — the basis of cross-stack references (step 3).
Validate statically before touching AWS:
cfn-lint templates/logging-bucket.yaml
aws cloudformation validate-template \
--template-body file://templates/logging-bucket.yaml
Split large templates into nested stacks, or use cross-stack exports for looser coupling between independently-owned layers:
# root.yaml — nested stack (tight coupling, single deploy unit)
Resources:
NetworkStack:
Type: AWS::CloudFormation::Stack
Properties:
TemplateURL: https://s3.amazonaws.com/<bucket>/network.yaml
Parameters:
EnvironmentName: !Ref EnvironmentName
AppStack:
Type: AWS::CloudFormation::Stack
Properties:
TemplateURL: https://s3.amazonaws.com/<bucket>/app.yaml
Parameters:
VpcId: !GetAtt NetworkStack.Outputs.VpcId
Use nested stacks when the layers always deploy and version
together (one owner, one release cadence). Use cross-stack exports
(Fn::ImportValue) instead when layers are owned/updated by different
teams on different cadences — an exported output can't be deleted or
changed incompatibly while another stack still imports it, which
CloudFormation enforces automatically and surfaces as a delete/update
block, protecting the consumer.
Never update a shared/production stack without reviewing a change set first:
aws cloudformation create-change-set \
--stack-name app-logs-staging \
--change-set-name update-retention-$(date +%Y%m%d%H%M) \
--template-body file://templates/logging-bucket.yaml \
--parameters ParameterKey=EnvironmentName,ParameterValue=staging \
ParameterKey=RetentionInDays,ParameterValue=30
aws cloudformation describe-change-set \
--stack-name app-logs-staging \
--change-set-name update-retention-<timestamp>
Read the Changes list: confirm each entry's Action
(Add/Modify/Remove) and, for Modify, whether
Replacement: True — a replacement means the resource is deleted and
recreated (new physical ID), which matters a great deal for anything
stateful (databases, buckets with data). Only after review:
aws cloudformation execute-change-set \
--stack-name app-logs-staging \
--change-set-name update-retention-<timestamp>
Roll the same template to many accounts/regions with a StackSet
instead of scripting per-account create-stack calls:
aws cloudformation create-stack-set \
--stack-set-name baseline-logging \
--template-body file://templates/logging-bucket.yaml \
--permission-model SERVICE_MANAGED \
--auto-deployment Enabled=true,RetainStacksOnAccountRemoval=false \
--capabilities CAPABILITY_NAMED_IAM
aws cloudformation create-stack-instances \
--stack-set-name baseline-logging \
--deployment-targets OrganizationalUnitIds=<ou-id> \
--regions us-east-1 eu-west-1 \
--operation-preferences FailureTolerancePercentage=10,MaxConcurrentPercentage=25
SERVICE_MANAGED permissions (via AWS Organizations) auto-provision the
needed roles in member accounts; SELF_MANAGED requires the admin/
execution roles to already exist in every target account.
FailureTolerancePercentage/MaxConcurrentPercentage cap blast radius:
a bad template stops rolling out after a bounded percentage of accounts
fail, rather than plowing through the whole organization.
Detect and reconcile drift after any suspected manual change:
aws cloudformation detect-stack-drift --stack-name app-logs-staging
aws cloudformation describe-stack-resource-drifts \
--stack-name app-logs-staging \
--stack-resource-drift-status-filters MODIFIED DELETED
For each MODIFIED/DELETED resource, decide: update the template to
match reality (if the manual change should stick) or run an update to
force the resource back to the template's declared state (if the
manual change was unauthorized). CloudFormation does not auto-correct
drift — detection is read-only and requires an explicit follow-up
update.
Treat stack deletion as destructive by default.
Warning:
aws cloudformation delete-stackdeletes every resource in the stack unless that resource'sDeletionPolicyis set toRetainorSnapshot— for a stateful resource (RDS instance, EBS volume, S3 bucket with data) the default is to delete the underlying data along with the stack. Before deleting any stack beyond a scratch/dev environment: confirmDeletionPolicy: Retain(orSnapshotfor RDS/EBS) is set on every stateful resource, confirm independent backups exist, and consider--retain-resourceson a targeted per-resource basis if only part of the stack should go away.
RetentionInDays: !Ref RetentionInDays
AppDatabase:
Type: AWS::RDS::DBInstance
DeletionPolicy: Snapshot # takes a final snapshot before deletion
UpdateReplacePolicy: Snapshot
AWSTemplateFormatVersion and keep one resource's logical ID stable
across template revisions — renaming a logical ID is treated as
delete-old/create-new, not a rename, even if the underlying properties
are identical.Fn::Sub and Fn::GetAtt over string concatenation for
cross-resource references so CloudFormation can infer the dependency
graph automatically; only fall back to explicit DependsOn when no
attribute reference exists to express the ordering.!GetAtt/!Ref to the resource being granted access, not
Resource: "*"), and require CAPABILITY_NAMED_IAM review by a human
or a policy gate whenever a template creates or modifies IAM.create-change-set/execute-change-set from CI so every stack update
has a reviewable diff and an audit trail, mirroring the plan-review gate
described in
infrastructure-as-code-terraform.aws cloudformation create-stack --tags Key=...) so
cost allocation and ownership are traceable; CloudFormation propagates
stack-level tags to every resource that supports tagging.UserData/cfn-init for that — hand off
to ansible-playbook-and-role-design
once the instance/AMI exists, and let CloudFormation own provisioning
only.Symptom: A change set shows Replacement: True for a resource that
should just update in place.
Fix: Some properties are immutable and force replacement (e.g.
changing an RDS engine version incompatibly, or an S3 bucket's Name).
Check the resource type's CloudFormation docs for which properties
require replacement, and if replacement is unavoidable for a stateful
resource, plan the swap explicitly (snapshot/restore, blue-green cutover)
rather than letting the change set execute unreviewed.
Symptom: aws cloudformation update-stack fails with Export ... cannot be deleted as it is in use by <other-stack>.
Fix: This is CloudFormation protecting a cross-stack reference —
find every consumer with
aws cloudformation list-imports --export-name <name> and update or
remove those consumers' imports first before the exporting stack can
change or remove that output.
Symptom: A stack sits in UPDATE_ROLLBACK_FAILED and no further
updates are accepted.
Fix: A resource failed to roll back automatically (often a
permissions issue during rollback, or a resource modified outside
CloudFormation mid-update). Use
aws cloudformation continue-update-rollback, optionally with
--resources-to-skip for the specific logical IDs that can't roll back
cleanly, then reconcile those resources' actual state against the
template afterward.
Symptom: detect-stack-drift reports resources as MODIFIED even
though nobody touched the console.
Fix: Some AWS-managed background processes (e.g. automatic minor
version patching on managed services) change attributes CloudFormation
considers drift. Confirm whether the drifted property is one your
template intentionally leaves unmanaged; if so, exclude it from drift
concern in the runbook rather than chasing false positives every cycle.
Symptom: A StackSet operation stops partway through with some
account/region instances FAILED and others SUCCEEDED.
Fix: Check FailureTolerancePercentage — a low tolerance stops the
rollout deliberately to cap blast radius. Inspect
describe-stack-instance for the failed target's reason (often a
missing execution role in a newly-added account), fix that specific
account, then re-run the operation only against the failed instances
rather than the whole set.
Scenario: Deploy a baseline "application logging bucket" stack to
staging first via a reviewed change set, then promote the same template
to every account in an AWS Organizations OU via StackSets.
templates/logging-bucket.yaml (as shown in step 1), plus a parameter
file per environment, params/staging.json:
[
{ "ParameterKey": "EnvironmentName", "ParameterValue": "staging" },
{ "ParameterKey": "RetentionInDays", "ParameterValue": "30" }
]
Stage 1 — single-account review and apply:
cfn-lint templates/logging-bucket.yaml
aws cloudformation create-change-set \
--stack-name app-logs-staging \
--change-set-name initial-deploy \
--template-body file://templates/logging-bucket.yaml \
--parameters file://params/staging.json
aws cloudformation describe-change-set \
--stack-name app-logs-staging --change-set-name initial-deploy
# Reviewer confirms: 1 resource to Add (LogsBucket), no Modify/Remove.
aws cloudformation execute-change-set \
--stack-name app-logs-staging --change-set-name initial-deploy
aws cloudformation wait stack-update-complete --stack-name app-logs-staging
Stage 2 — org-wide rollout once staging is validated:
aws cloudformation create-stack-set \
--stack-set-name baseline-logging \
--template-body file://templates/logging-bucket.yaml \
--permission-model SERVICE_MANAGED \
--auto-deployment Enabled=true,RetainStacksOnAccountRemoval=false \
--parameters ParameterKey=EnvironmentName,ParameterValue=prod \
ParameterKey=RetentionInDays,ParameterValue=90
aws cloudformation create-stack-instances \
--stack-set-name baseline-logging \
--deployment-targets OrganizationalUnitIds=ou-example-12345678 \
--regions us-east-1 eu-west-1 \
--operation-preferences FailureTolerancePercentage=10,MaxConcurrentPercentage=25
aws cloudformation list-stack-instances --stack-set-name baseline-logging
Six months later, a drift check confirms nothing was hand-edited:
aws cloudformation detect-stack-drift --stack-name app-logs-staging
aws cloudformation describe-stack-resource-drifts \
--stack-name app-logs-staging \
--stack-resource-drift-status-filters MODIFIED DELETED
# Empty result: no drift.
What SKILL.md sets; muted values are Claude Code's defaults
14 skills in this plugin
/ansible-playbook-and-role-designDesigns and safely runs Ansible playbooks, roles, and inventories for configuration management, including idempotent task design, Ansible Vault for secrets, and choosing config-management (Ansible) versus provisioning (Terraform/CloudFormation) for a given change. Use when the user asks to "write an Ansible playbook/role for X," "structure an Ansible inventory across environments," "make this task idempotent," "encrypt secrets with Ansible Vault," "dry-run a playbook before production," or "should this be Ansible or Terraform."
/chef-puppet-saltstack-legacy-config-managementProvides a comparative overview of Chef, Puppet, and SaltStack for teams maintaining existing legacy configuration-management estates alongside or instead of Ansible — agent-based pull architecture, DSL/resource models (Chef recipes/cookbooks, Puppet manifests/catalogs, Salt states/pillars), and a candid assessment of where each still earns its keep in a modern enterprise versus where it's inertia. Use when the user asks to "maintain this existing Chef/Puppet/Salt estate," "write a Chef recipe/Puppet manifest/Salt state," "should we migrate off Puppet to Ansible," "why is our Puppet run applying a change we didn't expect," or "compare Chef vs. Puppet vs. SaltStack."
/feature-flag-configuration-launchdarkly-and-unleashDesigns and operates feature flag configuration with LaunchDarkly or Unleash, covering flag lifecycle (create, target, roll out, retire), kill-switch patterns for fast incident mitigation without a redeploy, targeting/segmentation rules, and cleaning up stale flag debt before it accumulates into unreadable conditional logic. Use when the user asks to "add a feature flag for X," "set up a kill switch for this feature," "configure LaunchDarkly/Unleash targeting rules," "roll out a flag gradually by percentage," "clean up old feature flags," or "should we use LaunchDarkly or self-host Unleash."
/gremlin-chaos-engineering-configurationConfigures Gremlin-specific chaos engineering attacks — installing the Gremlin agent/sidecar, defining resource, state, and network attacks via the Gremlin API/CLI or Terraform provider, scoping blast radius with targets and halt conditions, and running Gremlin Scenarios for multi-step failure sequences. Use when the user asks to "configure a Gremlin attack," "set up the Gremlin agent in Kubernetes/EC2," "write a Gremlin Scenario," "scope a Gremlin blast radius/halt condition," or "use Gremlin to test our failover." For the general chaos-engineering principles (steady-state hypothesis, game days, tool-agnostic blast radius scoping) this configures against, use the SRE chaos-engineering-and-resilience-testing skill instead.
/infrastructure-post-deployment-validation-and-smoke-testingVerifies that a Terraform apply, CloudFormation deploy, or Ansible playbook run actually produced working infrastructure — resource existence and configuration checks, connectivity/health smoke tests, and automated post-apply assertions — rather than treating a clean "apply succeeded" exit code as proof the system works. Use when the user asks to "verify this deployment actually worked," "write a smoke test after terraform apply/cloudformation deploy," "check the resource is actually reachable/configured correctly post-deploy," "add post-deployment validation to the pipeline," or "our apply succeeded but the service is down."
/makefile-authoring-and-validationAuthors Makefiles as a build/automation entry point for ops tasks — `.PHONY` target conventions, dependency graphs between targets, variable/default handling, and self-documenting `help` targets — and validates them with `make -n` (dry-run) and `checkmake`/shellcheck-style linting before they're relied on in CI or by other engineers. Use when the user asks to "write a Makefile for this project," "add a build/lint/ test target to the Makefile," "why does `make` rebuild everything every time," "make targets phony," or "lint/validate this Makefile."
npx claudepluginhub selvarajmurugesan90/ops-engineering-skills --plugin iac-automation-skillsOther plugins' skills for the same job