Skip to content
Back to skills

Aws Patterns

ASecurity

When to activate: AWS, EC2, ECS, EKS, Lambda, RDS, S3, CloudFront, IAM, VPC, ALB, CloudWatch, CDK, CloudFormation

  • 2 stars
  • 0 votes
  • 0 copies
  • 6 views
  • Added October 26, 2026
ai-agentspythongoawsapidatabasedevopssecurity

Works with

  • cursor
  • cli
  • api

Security analysis

A100/100

Scanned October 26, 2026

npx -y skills add Mattakushi432/Claude-Code-Skills-Custom-DevTools-Pack --skill aws-patterns --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Aws Patterns?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Aws Patterns
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/mattakushi432-aws-patterns/badge)](https://www.skillsdirectory.com/skills/mattakushi432-aws-patterns)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: aws-patterns
description: "When to activate: AWS, EC2, ECS, EKS, Lambda, RDS, S3, CloudFront, IAM, VPC, ALB, CloudWatch, CDK, CloudFormation"
origin: zakr
metadata:
  namespace: zakr/devtools-pack
  version: 1.0.0
  category: devops
  language: devops
  platforms: [claude-code, codex, gemini-cli, cursor, aider, windsurf]
---
# AWS Patterns

## VPC Design (3-tier)

```
VPC: 10.0.0.0/16
  Public subnets   (10.0.1.0/24, 10.0.2.0/24) — ALB, NAT Gateway
  Private subnets  (10.0.10.0/24, 10.0.11.0/24) — ECS/EKS workloads
  Data subnets     (10.0.20.0/24, 10.0.21.0/24) — RDS, ElastiCache
```

## IAM Least Privilege (CDK)

```python
from aws_cdk import aws_iam as iam

lambda_role = iam.Role(self, "LambdaRole",
    assumed_by=iam.ServicePrincipal("lambda.amazonaws.com"),
    managed_policies=[
        iam.ManagedPolicy.from_aws_managed_policy_name(
            "service-role/AWSLambdaVPCAccessExecutionRole"
        )
    ]
)

# Only the specific S3 bucket, not *
lambda_role.add_to_policy(iam.PolicyStatement(
    actions=["s3:GetObject", "s3:PutObject"],
    resources=[f"{bucket.bucket_arn}/*"],
    effect=iam.Effect.ALLOW,
))
```

## Lambda Function (CDK)

```python
from aws_cdk import aws_lambda as lambda_, Duration

fn = lambda_.Function(self, "ApiHandler",
    runtime=lambda_.Runtime.PYTHON_3_12,
    handler="handler.main",
    code=lambda_.Code.from_asset("src"),
    timeout=Duration.seconds(30),
    memory_size=512,
    environment={
        "TABLE_NAME": table.table_name,
        "LOG_LEVEL": "INFO",
    },
    tracing=lambda_.Tracing.ACTIVE,  # X-Ray
    reserved_concurrent_executions=100,
)
table.grant_read_write_data(fn)
```

## ECS Fargate Service (CDK)

```python
from aws_cdk import aws_ecs as ecs, aws_ecs_patterns as patterns

service = patterns.ApplicationLoadBalancedFargateService(self, "Service",
    cluster=cluster,
    task_image_options=patterns.ApplicationLoadBalancedTaskImageOptions(
        image=ecs.ContainerImage.from_ecr_repository(repo, tag="1.2.3"),
        container_port=8080,
        environment={"LOG_LEVEL": "info"},
        secrets={"DB_PASSWORD": ecs.Secret.from_secrets_manager(secret)},
    ),
    desired_count=2,
    cpu=512,
    memory_limit_mib=1024,
    health_check_grace_period=Duration.seconds(60),
)

# Auto-scaling
scaling = service.service.auto_scale_task_count(max_capacity=10)
scaling.scale_on_cpu_utilization("CpuScaling",
    target_utilization_percent=70,
    scale_in_cooldown=Duration.seconds(60),
    scale_out_cooldown=Duration.seconds(30),
)
```

## RDS Aurora Serverless v2 (CDK)

```python
from aws_cdk import aws_rds as rds

cluster = rds.DatabaseCluster(self, "DB",
    engine=rds.DatabaseClusterEngine.aurora_postgres(
        version=rds.AuroraPostgresEngineVersion.VER_15_4
    ),
    serverless_v2_min_capacity=0.5,
    serverless_v2_max_capacity=16,
    writer=rds.ClusterInstance.serverless_v2("writer"),
    readers=[rds.ClusterInstance.serverless_v2("reader", scale_with_writer=True)],
    vpc=vpc,
    vpc_subnets=ec2.SubnetSelection(subnet_type=ec2.SubnetType.PRIVATE_WITH_EGRESS),
    backup=rds.BackupProps(retention=Duration.days(7)),
    deletion_protection=True,
    storage_encrypted=True,
)
```

## S3 + CloudFront (CDK)

```python
from aws_cdk import aws_s3 as s3, aws_cloudfront as cf, aws_cloudfront_origins as origins

bucket = s3.Bucket(self, "Assets",
    block_public_access=s3.BlockPublicAccess.BLOCK_ALL,
    encryption=s3.BucketEncryption.S3_MANAGED,
    enforce_ssl=True,
)

distribution = cf.Distribution(self, "CDN",
    default_behavior=cf.BehaviorOptions(
        origin=origins.S3BucketOrigin.with_origin_access_control(bucket),
        viewer_protocol_policy=cf.ViewerProtocolPolicy.REDIRECT_TO_HTTPS,
        cache_policy=cf.CachePolicy.CACHING_OPTIMIZED,
    ),
    price_class=cf.PriceClass.PRICE_CLASS_100,
)
```

## Key Rules
- Enable CloudTrail + GuardDuty in every account by default
- Use AWS Secrets Manager, not SSM Parameter Store, for sensitive values
- Tag all resources: `Environment`, `Team`, `CostCenter`, `ManagedBy`
- Enable VPC Flow Logs for security forensics
- Never use root account credentials — create IAM users/roles per team

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.