diff --git a/content/registry/packages/aws/guides/_index.md b/content/registry/packages/aws/guides/_index.md new file mode 100644 index 0000000000..532b161e66 --- /dev/null +++ b/content/registry/packages/aws/guides/_index.md @@ -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. diff --git a/content/registry/packages/aws/guides/ec2-auto-scaling.md b/content/registry/packages/aws/guides/ec2-auto-scaling.md new file mode 100644 index 0000000000..7995d3c8ea --- /dev/null +++ b/content/registry/packages/aws/guides/ec2-auto-scaling.md @@ -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. diff --git a/themes/default/layouts/guides/list.html b/themes/default/layouts/guides/list.html new file mode 100644 index 0000000000..dbf25e195d --- /dev/null +++ b/themes/default/layouts/guides/list.html @@ -0,0 +1,87 @@ +{{ define "hero" }} +
+
+

{{ .Title }}

+

{{ .Params.meta_desc }}

+ +
+
+{{ end }} + +{{ define "main" }} +
+
+
+ {{ .Content }} +
+ + {{ 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 }} +
+

+ {{ if eq $category "Compute" }} + + {{ else if eq $category "Database" }} + + {{ else if eq $category "Storage" }} + + {{ else if eq $category "Networking" }} + + {{ else }} + + {{ end }} + {{ $category }} +

+ + +
+ {{ end }} + {{ end }} + +
+

Ready to get started?

+

+ Deploy your infrastructure in minutes using Pulumi's modern infrastructure as code platform. +

+ + Start your journey + +
+
+
+{{ end }} \ No newline at end of file diff --git a/themes/default/layouts/guides/single.html b/themes/default/layouts/guides/single.html new file mode 100644 index 0000000000..4e584a1316 --- /dev/null +++ b/themes/default/layouts/guides/single.html @@ -0,0 +1,150 @@ +{{ define "hero" }} +
+
+ + + + +
+

+ {{ .Title }} +

+

+ {{ .Params.meta_desc }} +

+ + + {{ if .Params.tags }} +
+ {{ range .Params.tags }} + + {{ . }} + + {{ end }} +
+ {{ end }} +
+
+
+{{ end }} + +{{ define "main" }} +
+
+
+ + + + + +
+
+
+ + +{{ end }} \ No newline at end of file diff --git a/themes/default/layouts/index.json b/themes/default/layouts/index.json index d3d2a7c1de..320ef50bdb 100644 --- a/themes/default/layouts/index.json +++ b/themes/default/layouts/index.json @@ -6,17 +6,19 @@ {{ $ancestors = $ancestors | append $a.LinkTitle }} {{- end -}} - {{- - $index = $index | append ( - dict - "objectID" $page.File.UniqueID - "title" $page.Title - "section" $page.Section - "href" $page.RelPermalink - "params" $page.Params - "kind" $page.Kind - "ancestors" (after 1 $ancestors) - ) - -}} + {{- if $page.File -}} + {{- + $index = $index | append ( + dict + "objectID" $page.File.UniqueID + "title" $page.Title + "section" $page.Section + "href" $page.RelPermalink + "params" $page.Params + "kind" $page.Kind + "ancestors" (after 1 $ancestors) + ) + -}} + {{- end -}} {{- end -}} {{- $index | jsonify (dict "indent" " ") -}} diff --git a/themes/default/layouts/partials/registry/package/pulumi-ai.html b/themes/default/layouts/partials/registry/package/pulumi-ai.html index cd5e2d885d..f850589b9e 100644 --- a/themes/default/layouts/partials/registry/package/pulumi-ai.html +++ b/themes/default/layouts/partials/registry/package/pulumi-ai.html @@ -1,4 +1,12 @@ +{{/* + To regenerate get-started-with-pulumi.svg: + 1. npm install opentype.js + 2. node text-to-path.js ./public/fonts/gilroy-medium.woff "Get Started" 20 50 29 + 3. Wrap output path in SVG with: width="180" height="46" viewBox="0 0 180 46" + 4. Include Pulumi logo elements and background: fill="#2B2B2C" +*/}} {{ $title_tag := .Scratch.Get "title_tag" }} - - Deploy with Pulumi +{{ $prompt := printf "Explain resource %s, it's top scenarios and create a example usage for me." $title_tag }} + + Get Started diff --git a/themes/default/layouts/shortcodes/llm-explain.html b/themes/default/layouts/shortcodes/llm-explain.html new file mode 100644 index 0000000000..f54418c9b6 --- /dev/null +++ b/themes/default/layouts/shortcodes/llm-explain.html @@ -0,0 +1,81 @@ +{{/* + Dummy shortcode for LLM-generated explanations + + This shortcode will use an LLM (Claude) to generate contextual content + based on Pulumi resources from the registry. + + Usage: + {{< llm-explain + resource="aws.autoscaling.Group" + context="This guide explains EC2 Auto Scaling Groups" + prompt="Explain the key configuration parameters. Return as markdown list with bold parameter names." + example="**desiredCapacity**: The number of instances to maintain." + >}} + + Parameters: + - resource: The Pulumi resource type (required) + - context: Additional context about what this guide/section covers (optional) + - prompt: The specific prompt/question for the LLM (required) + - example: Example of desired output format (optional) + + How it will work: + 1. Fetch resource schema/docs from registry as context + 2. Send prompt + context + example to Claude API + 3. Cache response (keyed by resource + prompt hash) + 4. Render markdown response +*/}} + +{{ $resource := .Get "resource" }} +{{ $context := .Get "context" | default "" }} +{{ $prompt := .Get "prompt" }} +{{ $example := .Get "example" | default "" }} + +
+
+ + + +
+

πŸ€– LLM-Generated Content (Placeholder)

+

+ Resource: {{ $resource }} +

+ {{ if $context }} +

+ Context: {{ $context }} +

+ {{ end }} +
+
+ +
+

Prompt to Claude:

+
+

System: You are a technical writer for Pulumi documentation.

+ +

Resource Context:
+ Resource: {{ $resource }}
+ [Will include: schema, properties, examples from registry API docs]

+ + {{ if $context }} +

Guide Context:
{{ $context }}

+ {{ end }} + +

Task:
{{ $prompt }}

+ + {{ if $example }} +

Example Output:
{{ $example }}

+ {{ end }} +
+
+ +
+

Implementation:

+
+

βœ“ Call Claude API at build time

+

βœ“ Cache in: static/registry/packages/llm-cache/{{ $resource | md5 }}.md

+

βœ“ Fallback to manual content if API fails

+

βœ“ Manual override: content/registry/packages/aws/llm-overrides/[resource].md

+
+
+
diff --git a/themes/default/layouts/shortcodes/resource-example.html b/themes/default/layouts/shortcodes/resource-example.html new file mode 100644 index 0000000000..c40e714f27 --- /dev/null +++ b/themes/default/layouts/shortcodes/resource-example.html @@ -0,0 +1,55 @@ +{{/* + Dummy shortcode for resource-example + + This is a placeholder that demonstrates how the shortcode will work. + Eventually this will: + 1. Read from static/registry/packages/examples/{provider}/{resource}.json + 2. Render multi-language examples from the resource's API docs + + Usage: {{< resource-example provider="aws" resource="aws.autoscaling.Group" >}} + + Note: The resource parameter uses Pulumi SDK format (e.g., aws.autoscaling.Group) + and maps directly to the filename (aws.autoscaling.Group.json). +*/}} + +{{ $provider := .Get "provider" }} +{{ $resource := .Get "resource" }} + +
+
+ + + +
+

🚧 Placeholder for resource-example shortcode

+

+ Provider: {{ $provider }}
+ Resource: {{ $resource }} +

+

+ This shortcode will eventually pull multi-language examples from:
+ + /static/registry/packages/examples/{{ $provider }}/{{ $resource }}.json + +

+
+
+ +
+

What this will render:

+ +
+ +
+ Implementation notes: + +
+
diff --git a/themes/default/static/images/deploy-with-pulumi.svg b/themes/default/static/images/deploy-with-pulumi.svg new file mode 100644 index 0000000000..799846e632 --- /dev/null +++ b/themes/default/static/images/deploy-with-pulumi.svg @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/themes/default/static/images/get-started-with-pulumi.svg b/themes/default/static/images/get-started-with-pulumi.svg new file mode 100644 index 0000000000..20f92a2bcc --- /dev/null +++ b/themes/default/static/images/get-started-with-pulumi.svg @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + +