Writing Skills
writing-skills
效率与协作技能,来自 obra/superpowers,查看原文获取完整用途和操作说明。
developer-platforms-devops-pulumi【部署与运维】Implements detailed Pulumi deployment processes in cloud environments, focusing on stacks, resources, programs, deployments, and best practices for effective infrastructure management.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
name: developer-platforms-devops-pulumi description: Implements detailed Pulumi deployment processes in cloud environments, focusing on stacks, resources, programs, deployments, and best practices for effective infrastructure management. license: MIT compatibility: opencode metadata: archetypes: implementation, orchestration anti_triggers: cloud management, infrastructure as code response_profile: verbosity: medium directive_strength: high
version: "1.0.0" domain: cncf triggers: pulumi, infrastructure as code, stacks, cloud deployments, resource management, best practices, pulumi examples role: implementation scope: infrastructure output-format: code related-skills: pulumi, pulumi-aws, pulumi-azure, pulumi-gcp
Implements detailed Pulumi deployment processes in cloud environments, focusing on stacks, resources, programs, deployments, and best practices for effective infrastructure management.
pulumi previewPulumi's infrastructure management follows these steps:
pulumi new <template> to scaffold a new project.pulumi stack init <stack-name> to create and manage stacks for different environments.pulumi preview to avoid unintended changes.pulumi up to deploy the defined infrastructure.pulumi stack and adjust configurations as necessary.A foundational setup for organizing projects into stacks.
import pulumi
import pulumi_aws as aws
def create_stack(environment):
# Create a new stack
pulumi.stack.create_stack(env=environment)
print(f"Stack '{environment}' has been created.")
# Initialize the stack based on environment
create_stack("development")
Detailing how to define various resources with potential dependencies.
import pulumi
import pulumi_aws as aws
from typing import Optional
# Example function to provision an EC2 instance
def create_ec2_instance(environment: str, instance_type: Optional[str] = "t2.micro"):
ami = aws.ec2.get_ami(most_recent=True, owners=["amazon"], filters=[aws.ec2.GetAmiFilterArgs(
name="name",
values=["amzn2-ami-hvm-*-x86_64-gp2"],
)])
instance = aws.ec2.Instance(
f"{environment}-instance",
ami=ami.id,
instance_type=instance_type,
tags={
"Name": f"{environment}-instance",
}
)
return instance
# Creating an EC2 based on environment
create_ec2_instance("production")
Implementing deployment strategies to manage application lifecycle.
import pulumi
import pulumi_kubernetes as k8s
def deploy_k8s_app(app_name: str, image: str):
# Define a Kubernetes Deployment for the application
deployment = k8s.apps.v1.Deployment(app_name, spec=k8s.apps.v1.DeploymentSpec(
replicas=2,
selector={
"matchLabels": {"app": app_name}
},
template=k8s.core.v1.PodTemplateSpec(
metadata={
"labels": {"app": app_name}
},
spec=k8s.core.v1.PodSpec(
containers=[{
"name": app_name,
"image": image,
"ports": [{"containerPort": 80}]
}]
)
)
))
return deployment
# Deploy application in Kubernetes
# Example usage
deploy_k8s_app("myapp", "myapp:latest")
Capture the best practices in Pulumi implementations.
pulumi up.When implementing Pulumi infrastructure, ensure to include:
Authoritative documentation links for this skill's domain. The model follows markdown links at load time to resolve external references and inline content.