Skip to content
Draft
23 changes: 23 additions & 0 deletions content/registry/packages/aws/guides/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
title: "AWS Guides"
meta_desc: "Quick, practical solutions to common AWS infrastructure problems using verified code from the Pulumi Registry."
layout: package
---

Copy-paste AWS infrastructure solutions that actually work. Every guide uses tested code from the [Pulumi AWS Registry](/registry/packages/aws/)—just customize and deploy.

## What makes a guide?

- **Focused on one problem** - Each guide solves a specific, real-world AWS challenge
- **Tested code** - All code examples are verified and production-ready
- **Clear guidance** - Includes when to use it, important notes, and considerations
- **Quick to implement** - Copy, customize, and deploy in minutes

## How to use guides

1. Find a guide that matches your problem
2. Copy the code example
3. Customize it for your specific needs
4. Deploy with `pulumi up`

Browse guides by category below, or explore the full [AWS Registry](/registry/packages/aws/) for comprehensive API documentation.
53 changes: 53 additions & 0 deletions content/registry/packages/aws/guides/ec2-auto-scaling.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
title: "Auto-Scale EC2 Instances"
meta_desc: "Scale EC2 instances based on demand using AWS Auto Scaling Groups with launch templates and Pulumi."
canonical_url: "https://www.pulumi.com/guides/aws/ec2-auto-scaling"
date: 2025-10-08
category: "Compute"
tags: ["aws", "ec2", "auto-scaling", "high-availability", "elasticity"]
faq:
- question: What is the difference between launch templates and launch configurations?
answer: Launch templates are the newer, recommended approach. They support all the latest EC2 features including T2/T3 unlimited mode, spot instances, and more instance types. Launch configurations are deprecated and lack these features. Always use launch templates for new deployments.
- question: How does Auto Scaling maintain high availability?
answer: Auto Scaling continuously monitors the health of instances. When an instance fails health checks, Auto Scaling automatically terminates it and launches a replacement to maintain your desired capacity. Distributing instances across multiple availability zones provides additional resilience.
- question: What is the cooldown period and why does it matter?
answer: The cooldown period (default 300 seconds) is the time between scaling activities. It prevents Auto Scaling from launching or terminating instances too quickly when metrics fluctuate. Adjust this based on your application's startup time - longer for slow-starting apps.
- question: How do I add scaling policies to respond to load?
answer: Use aws.autoscaling.Policy resources to define target tracking or step scaling policies. Target tracking (recommended) automatically adjusts capacity to maintain a metric like CPU utilization at 70%. This example shows the basic group; scaling policies are added separately.
- question: Can I use Auto Scaling with a load balancer?
answer: Yes, and it's recommended for production. Attach your Auto Scaling Group to an Application Load Balancer or Network Load Balancer. The load balancer distributes traffic across healthy instances, and you can configure health checks to let Auto Scaling know when to replace unhealthy instances.
---

## How do I auto-scale EC2 instances with AWS Auto Scaling Groups?

**To automatically scale EC2 instances based on demand**, create an Auto Scaling Group with a launch template that defines your instance configuration. Auto Scaling maintains your desired capacity, replaces unhealthy instances, and can scale up or down in response to load.

### Example: Basic Auto Scaling Group

{{< resource-example provider="aws" resource="aws.autoscaling.Group" >}}

## Key configuration details

{{< llm-explain
resource="aws.autoscaling.Group"
context="This guide explains how to set up EC2 Auto Scaling Groups with Pulumi"
prompt="Explain the key configuration parameters for this resource. Return as a markdown list with bold parameter names followed by concise, actionable explanations. Focus on what users need to know for production deployments."
example="**desiredCapacity**: The number of instances to maintain. Auto Scaling replaces failed instances to maintain this count. Set based on baseline load."
>}}

## Frequently asked questions

**What is the difference between launch templates and launch configurations?**
Launch templates are the newer, recommended approach. They support all the latest EC2 features including T2/T3 unlimited mode, spot instances, and more instance types. Launch configurations are deprecated and lack these features. Always use launch templates for new deployments.

**How does Auto Scaling maintain high availability?**
Auto Scaling continuously monitors the health of instances. When an instance fails health checks, Auto Scaling automatically terminates it and launches a replacement to maintain your desired capacity. Distributing instances across multiple availability zones provides additional resilience.

**What is the cooldown period and why does it matter?**
The cooldown period (default 300 seconds) is the time between scaling activities. It prevents Auto Scaling from launching or terminating instances too quickly when metrics fluctuate. Adjust this based on your application's startup time - longer for slow-starting apps.

**How do I add scaling policies to respond to load?**
Use aws.autoscaling.Policy resources to define target tracking or step scaling policies. Target tracking (recommended) automatically adjusts capacity to maintain a metric like CPU utilization at 70%. This example shows the basic group; scaling policies are added separately.

**Can I use Auto Scaling with a load balancer?**
Yes, and it's recommended for production. Attach your Auto Scaling Group to an Application Load Balancer or Network Load Balancer. The load balancer distributes traffic across healthy instances, and you can configure health checks to let Auto Scaling know when to replace unhealthy instances.
87 changes: 87 additions & 0 deletions themes/default/layouts/guides/list.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
{{ define "hero" }}
<div class="bg-gradient-to-br from-purple-600 to-blue-600 py-20">
<div class="container mx-auto px-4 text-center">
<h1 class="text-5xl md:text-6xl font-bold text-white mb-6">{{ .Title }}</h1>
<p class="text-xl md:text-2xl text-purple-100 mb-8 max-w-3xl mx-auto">{{ .Params.meta_desc }}</p>
<div class="flex flex-wrap justify-center gap-4">
<a href="/docs/get-started/" class="inline-flex items-center px-6 py-3 bg-white text-purple-700 font-semibold rounded-lg hover:bg-purple-50 transition-all shadow-lg hover:shadow-xl">
<i class="fas fa-rocket mr-2"></i>Get started
</a>
<a href="/registry/" class="inline-flex items-center px-6 py-3 bg-purple-700 text-white font-semibold rounded-lg hover:bg-purple-800 transition-all shadow-lg hover:shadow-xl">
<i class="fas fa-book mr-2"></i>Browse registry
</a>
</div>
</div>
</div>
{{ end }}

{{ define "main" }}
<div class="bg-gray-50 py-16">
<div class="container mx-auto px-4 max-w-7xl">
<div class="bg-white rounded-lg shadow-sm p-6 md:p-8 mb-12 prose prose-lg max-w-none">
{{ .Content }}
</div>

{{ if .Pages }}
{{ $categories := dict }}
{{ range .Pages }}
{{ $cat := .Params.category | default "General" }}
{{ $list := index $categories $cat | default slice }}
{{ $categories = merge $categories (dict $cat ($list | append .)) }}
{{ end }}

{{ range $category, $pages := $categories }}
<div class="mb-12">
<h2 class="text-2xl md:text-3xl font-bold text-gray-900 mb-6 flex items-center">
{{ if eq $category "Compute" }}
<i class="fas fa-microchip text-purple-600 mr-3"></i>
{{ else if eq $category "Database" }}
<i class="fas fa-database text-blue-600 mr-3"></i>
{{ else if eq $category "Storage" }}
<i class="fas fa-hdd text-green-600 mr-3"></i>
{{ else if eq $category "Networking" }}
<i class="fas fa-network-wired text-orange-600 mr-3"></i>
{{ else }}
<i class="fas fa-layer-group text-gray-600 mr-3"></i>
{{ end }}
{{ $category }}
</h2>

<div class="grid md:grid-cols-2 gap-6">
{{ range $pages }}
<a href="{{ .RelPermalink }}" class="block bg-white rounded-lg shadow-sm hover:shadow-xl transition-shadow duration-300 overflow-hidden border border-gray-200 hover:border-purple-300 group">
<div class="p-6">
<h3 class="text-xl font-semibold text-gray-900 mb-3">
{{ .Title }}
<i class="fas fa-arrow-right text-purple-600 ml-2 opacity-0 group-hover:opacity-100 transition-opacity duration-300 inline-block"></i>
</h3>
<p class="text-gray-600 leading-relaxed mb-4">{{ .Params.meta_desc }}</p>
{{ if .Params.tags }}
<div class="flex flex-wrap gap-2">
{{ range .Params.tags }}
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-purple-100 text-purple-800">
{{ . }}
</span>
{{ end }}
</div>
{{ end }}
</div>
</a>
{{ end }}
</div>
</div>
{{ end }}
{{ end }}

<div class="bg-gradient-to-br from-purple-600 to-blue-600 rounded-lg shadow-lg p-8 md:p-12 text-center mt-16">
<h2 class="text-2xl md:text-3xl font-bold text-white mb-4">Ready to get started?</h2>
<p class="text-lg md:text-xl text-purple-100 mb-8 max-w-2xl mx-auto">
Deploy your infrastructure in minutes using Pulumi's modern infrastructure as code platform.
</p>
<a href="/docs/get-started/" class="inline-flex items-center px-8 py-4 bg-white text-purple-700 font-bold rounded-lg hover:bg-purple-50 transition-all shadow-lg hover:shadow-xl text-lg">
<i class="fas fa-rocket mr-2"></i>Start your journey
</a>
</div>
</div>
</div>
{{ end }}
Loading
Loading