From developer-kit-aws
Creates AWS CloudFormation templates for EC2 instances (On-Demand/SPOT), Security Groups, IAM roles, ALBs, Target Groups, and template structures with Parameters, Outputs, Mappings, Conditions, cross-stack references.
How this skill is triggered — by the user, by Claude, or both
Slash command
/developer-kit-aws:aws-cloudformation-ec2This skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Create production-ready EC2 infrastructure using AWS CloudFormation templates. Covers EC2 instances (On-Demand and SPOT), Security Groups, IAM roles, Application Load Balancers (ALB), template structure, parameters, outputs, and cross-stack references.
Create production-ready EC2 infrastructure using AWS CloudFormation templates. Covers EC2 instances (On-Demand and SPOT), Security Groups, IAM roles, Application Load Balancers (ALB), template structure, parameters, outputs, and cross-stack references.
Use AWS-specific parameter types for validation and console dropdowns.
Parameters:
LatestAmiId:
Type: AWS::SSM::Parameter::Value<AWS::EC2::Image::Id>
Default: /aws/service/ami-amazon-linux-latest/amzn2-ami-hvm-x86_64-gp2
InstanceType:
Type: AWS::EC2::InstanceType
Default: t3.micro
AllowedValues: [t3.micro, t3.small, t3.medium]
KeyName:
Type: AWS::EC2::KeyPair::KeyName
See template-structure.md for advanced parameter patterns, mappings, conditions, and cross-stack references.
Define ingress/egress rules for network access.
InstanceSecurityGroup:
Type: AWS::EC2::SecurityGroup
Properties:
GroupDescription: Security group for EC2 instance
VpcId: !Ref VpcId
SecurityGroupIngress:
- IpProtocol: tcp
FromPort: 80
ToPort: 80
CidrIp: 0.0.0.0/0
- IpProtocol: tcp
FromPort: 22
ToPort: 22
CidrIp: 10.0.0.0/16
See security-iam.md for advanced security group patterns, self-references, and IAM roles.
Define instance profile with least privilege permissions.
Ec2Role:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument:
Version: "2012-10-17"
Statement:
- Effect: Allow
Principal:
Service: ec2.amazonaws.com
Action: sts:AssumeRole
ManagedPolicyArns:
- arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore
Ec2InstanceProfile:
Type: AWS::IAM::InstanceProfile
Properties:
Roles: [!Ref Ec2Role]
See security-iam.md for least privilege policies, SSM roles, and trust policies.
Configure instance with security group, IAM role, and user data.
Ec2Instance:
Type: AWS::EC2::Instance
Properties:
ImageId: !Ref LatestAmiId
InstanceType: !Ref InstanceType
KeyName: !Ref KeyName
SecurityGroupIds: [!Ref InstanceSecurityGroup]
IamInstanceProfile: !Ref Ec2InstanceProfile
SubnetId: !Ref SubnetId
UserData:
Fn::Base64: |
#!/bin/bash
yum update -y
yum install -y httpd
systemctl start httpd
Tags:
- Key: Name
Value: !Sub ${AWS::StackName}-instance
See ec2-instances.md for multi-volume configurations, detailed monitoring, SPOT instances, and complete stack examples.
Validate template: aws cloudformation validate-template --template-body file://template.yaml
Create ALB with target group and listener for traffic distribution.
ApplicationLoadBalancer:
Type: AWS::ElasticLoadBalancingV2::LoadBalancer
Properties:
Name: !Sub ${AWS::StackName}-alb
Scheme: internet-facing
SecurityGroups: [!Ref AlbSecurityGroup]
Subnets: [!Ref PublicSubnet1, !Ref PublicSubnet2]
ApplicationTargetGroup:
Type: AWS::ElasticLoadBalancingV2::TargetGroup
Properties:
Port: 80
Protocol: HTTP
VpcId: !Ref VpcId
HealthCheckPath: /health
ApplicationListener:
Type: AWS::ElasticLoadBalancingV2::Listener
Properties:
DefaultActions:
- Type: forward
TargetGroupArn: !Ref ApplicationTargetGroup
LoadBalancerArn: !Ref ApplicationLoadBalancer
Port: 80
Protocol: HTTP
See load-balancers.md for HTTPS configuration, path-based routing, host-based routing, listener rules, and ALB attributes.
Export values for cross-stack references.
Outputs:
InstanceId:
Description: EC2 Instance ID
Value: !Ref Ec2Instance
Export:
Name: !Sub ${AWS::StackName}-InstanceId
SecurityGroupId:
Description: Security Group ID
Value: !Ref InstanceSecurityGroup
Export:
Name: !Sub ${AWS::StackName}-SecurityGroupId
LoadBalancerDnsName:
Description: ALB DNS Name
Value: !GetAtt ApplicationLoadBalancer.DNSName
See template-structure.md for cross-stack reference patterns and import/export strategies.
AWSTemplateFormatVersion: "2010-09-09"
Description: EC2 instance with ALB
Parameters:
LatestAmiId:
Type: AWS::SSM::Parameter::Value<AWS::EC2::Image::Id>
Default: /aws/service/ami-amazon-linux-latest/amzn2-ami-hvm-x86_64-gp2
InstanceType:
Type: AWS::EC2::InstanceType
Default: t3.micro
Resources:
InstanceSecurityGroup:
Type: AWS::EC2::SecurityGroup
Properties:
GroupDescription: Enable HTTP and SSH
SecurityGroupIngress:
- IpProtocol: tcp
FromPort: 80
ToPort: 80
CidrIp: 0.0.0.0/0
Ec2Instance:
Type: AWS::EC2::Instance
Properties:
ImageId: !Ref LatestAmiId
InstanceType: !Ref InstanceType
SecurityGroupIds: [!Ref InstanceSecurityGroup]
LoadBalancer:
Type: AWS::ElasticLoadBalancingV2::LoadBalancer
Properties:
Scheme: internet-facing
SecurityGroups: [!Ref InstanceSecurityGroup]
Subnets: [subnet-12345678, subnet-87654321]
Outputs:
InstanceId:
Value: !Ref Ec2Instance
LoadBalancerDns:
Value: !GetAtt LoadBalancer.DNSName
# Create change set
aws cloudformation create-change-set \
--stack-name my-ec2-stack \
--template-body file://template.yaml \
--change-set-type CREATE
# Execute after review
aws cloudformation execute-change-set \
--change-set-name <change-set-name>
See examples.md for complete production-ready templates.
AWS::EC2::VPC::Id, AWS::EC2::InstanceType)AWS::StackName prefixaws cloudformation validate-templateSee best-practices.md for detailed guidance on stack policies, termination protection, drift detection, change set automation, and validation scripts.
See constraints.md for complete constraints, troubleshooting guides, and monitoring setup.
npx claudepluginhub giuseppe-trisciuoglio/developer-kit --plugin developer-kit-awsProvides AWS CloudFormation patterns for ECS clusters, task definitions, services, auto scaling, blue/green deployments, ALB/NLB integration, and monitoring. Use for Fargate/EC2 setups and best practices.
Optimizes CloudFormation templates with best practices for nested stacks, drift detection, and production-ready patterns. Use when writing or reviewing CF templates.
Author, validate, and troubleshoot AWS CloudFormation templates using secure defaults, cfn-lint, cfn-guard, change sets, and CloudTrail events for failed stacks.