giuseppe-trisciuoglio/developer-kit/aws-cloudformation-ec2
- community
Checking that the SKILL.md file is still in the repository.
Provides AWS CloudFormation patterns for EC2 instances, Security Groups, IAM roles, and load balancers. Use when creating EC2 instances, SPOT instances, Security Groups, IAM roles for EC2, Application Load Balancers (ALB), Target Groups, and implementing template structure with Parameters, Outputs, Mappings, Conditions, and cross-stack references.
Install
npx vskill@latest install giuseppe-trisciuoglio/developer-kit/aws-cloudformation-ec2SKILL.md
AWS CloudFormation EC2 Infrastructure
Overview
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.
When to Use
- Creating EC2 instances (On-Demand or SPOT) with Security Groups and IAM roles
- Setting up Application Load Balancers with target groups
- Implementing template Parameters, Mappings, Conditions, and cross-stack references
Instructions
Step 1 — Define Template Parameters
Use AWS-specific parameter types for validation and console dropdowns.
See template-structure.md for advanced parameter patterns, mappings, conditions, and cross-stack references.
Step 2 — Create Security Group
Define ingress/egress rules for network access.
See security-iam.md for advanced security group patterns, self-references, and IAM roles.
Step 3 — Configure IAM Role
Define instance profile with least privilege permissions.
See security-iam.md for least privilege policies, SSM roles, and trust policies.
Step 4 — Launch EC2 Instance
Configure instance with security group, IAM role, and user data.
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
Step 5 — Add Application Load Balancer
Create ALB with target group and listener for traffic distribution.
See load-balancers.md for HTTPS configuration, path-based routing, host-based routing, listener rules, and ALB attributes.
Step 6 — Define Outputs
Export values for cross-stack references.
See template-structure.md for cross-stack reference patterns and import/export strategies.
Examples
Minimal EC2 with ALB Template
Deploy with Change Set
See examples.md for complete production-ready templates.
Best Practices
Template Structure
- Use AWS-specific parameter types for validation (
AWS::EC2::VPC::Id,AWS::EC2::InstanceType) - Organize by lifecycle - separate network, security, and application stacks
- Use meaningful names with
AWS::StackNameprefix - Enable termination protection on production stacks
Security
- Apply least privilege to IAM roles - grant minimum required permissions
- Use security group references instead of IP addresses where possible
- Enable IMDSv2 on all EC2 instances
- Restrict security group rules to specific CIDR blocks
Cost & Availability
- Use SPOT instances for fault-tolerant, interruptible workloads
- Deploy across multiple AZs for high availability
- Set up CloudWatch alarms for CPU and status checks
- Use EBS gp3 volumes for cost-effective storage
Operations
- Always use change sets for production stack updates
- Enable drift detection to maintain template compliance
- Apply stack policies to protect critical resources
- Validate templates before deployment with
aws cloudformation validate-template
See best-practices.md for detailed guidance on stack policies, termination protection, drift detection, change set automation, and validation scripts.
References
Core Configuration
- [template-structure.md](references/template-structure.md) — Template sections, parameters, mappings, conditions, outputs, cross-stack references
- [ec2-instances.md](references/ec2-instances.md) — EC2 instances, SPOT fleets, multi-volume configurations, complete stack examples
- [security-iam.md](references/security-iam.md) — Security groups, IAM roles, instance profiles, least privilege policies
- [load-balancers.md](references/load-balancers.md) — ALB configuration, target groups, listeners, path-based routing, HTTPS
Operational Guides
- [best-practices.md](references/best-practices.md) — Stack policies, termination protection, drift detection, change sets, validation
- [constraints.md](references/constraints.md) — Resource limits, instance constraints, cost considerations, common issues, monitoring
Additional Resources
- [examples.md](references/examples.md) — Complete production-ready examples and use cases
- [reference.md](references/reference.md) — CloudFormation EC2 resource reference documentation
Constraints and Warnings
Resource Limits
- Maximum 500 resources per CloudFormation stack
- Maximum 500 security groups per VPC
- Instance types vary by region/A availability
Cost Considerations
- EC2 instances incur costs while running
- EBS volumes charged per GB-month even when not attached
- ALBs have hourly + LCU data processing costs
- Unattached Elastic IPs incur hourly costs
Security Considerations
- Key pairs cannot be recovered if lost
- Instance profile roles cannot be changed after creation
- IMDSv1 has security vulnerabilities - use IMDSv2
- Spot instances can be terminated with 2-minute notice
See constraints.md for complete constraints, troubleshooting guides, and monitoring setup.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingplugins/developer-kit-aws/skills/aws-cloudformation/aws-cloudformation-ec2/SKILL.md
Popularity
- Repository stars
- 348
- Repository forks
- 41
- 7-day trend score
- 29
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 23 Sep 2026, a month ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/giuseppe-trisciuoglio/developer-kit/aws-cloudformation-ec2)