Skip to main content

AWS Best Practices

Knowing which AWS services exist is only the beginning. The difference between a functional prototype and a production‑ready system lies in how you apply those services—how you secure access, manage traffic, handle failure, control cost, and operate at scale. Best practices are the accumulated engineering wisdom that turns platform knowledge into reliable, maintainable, and efficient workloads.

This section organises that guidance into a set of practical domains. Each page focuses on a specific area and provides actionable, vendor‑aware recommendations that complement the architectural patterns described elsewhere. Use this hub to find the operational and engineering standards you need when designing, deploying, and running AWS systems.

Engineering Lifecycle

AWS best practices span every phase of the cloud lifecycle. The sections that follow are organised around a progression that mirrors how real systems evolve.

Design

Build

Deploy

Operate

Observe

Optimize

Security Best Practices

Security is foundational and must be embedded in every layer. These practices help you protect data, manage identity, and detect threats.

  • Least Privilege – Grant only the permissions required to perform a task, and review those permissions regularly.
  • IAM Design – Structure roles, users, and policies using clear naming conventions and resource‑based boundaries.
  • Multi-Factor Authentication – Require MFA for all human users, especially for privileged and root accounts.
  • Encryption – Encrypt data at rest by default and use TLS for data in transit; manage keys with AWS KMS.
  • Secrets Management – Store credentials, API keys, and certificates in a managed service like AWS Secrets Manager, never in code or environment variables.
  • Key Rotation – Automate the rotation of access keys, database credentials, and signing certificates to limit the impact of a compromise.
  • Security Monitoring – Enable AWS CloudTrail for audit logs, GuardDuty for threat detection, and Security Hub for a unified view.
  • Compliance – Map your security controls to frameworks like CIS, NIST, or SOC2, and use AWS Config to monitor compliance over time.
  • Zero Trust – Design network and identity policies that assume breach; verify every request, even those that originate inside your own VPC.

Networking Best Practices

A well‑designed network isolates workloads, controls traffic flow, and provides secure connectivity to other environments.

  • VPC Design – Plan your CIDR blocks carefully, avoid overlap, and use separate VPCs for different environments or business units.
  • Multi‑AZ Networking – Place subnets in multiple Availability Zones and use load balancers to distribute traffic across them.
  • Network Segmentation – Use security groups and network ACLs to restrict traffic between tiers; place public‑facing resources in separate subnets.
  • Private Connectivity – Keep databases and internal services in private subnets; route outbound traffic through a NAT Gateway or VPC endpoints.
  • Hybrid Connectivity – When connecting to on‑premises networks, prefer Direct Connect for consistent performance, and use VPN as a fallback.
  • DNS Design – Use Route 53 for both public and private DNS; create private hosted zones for internal service discovery.
  • Load Balancing – Place an Application Load Balancer or Network Load Balancer in front of your compute layer to handle traffic distribution and health checks.
  • Network Security – Deploy AWS WAF to filter malicious web requests and use VPC Flow Logs to monitor traffic patterns.

Compute Best Practices

Compute choices affect cost, performance, and operational overhead. Apply these practices to get the most from EC2, Lambda, and related services.

  • EC2 Design – Right‑size instances, use instance profiles instead of static credentials, and select the correct pricing model (On‑Demand, Reserved, Spot).
  • Auto Scaling – Set up Auto Scaling groups with health checks and scaling policies so your application adds or removes capacity in response to demand.
  • Instance Selection – Benchmark different instance families to match CPU, memory, and network characteristics to your workload.
  • Stateless Applications – Store session state externally (e.g., in DynamoDB or ElastiCache) so that any instance can handle any request and scaling is seamless.
  • Immutable Infrastructure – Build new AMIs or container images instead of patching running instances; replace instances rather than modifying them in place.
  • Compute Optimization – Use burstable instances for spiky workloads, consider Graviton processors for price/performance, and profile applications to find bottlenecks.

Storage Best Practices

Choose the right storage service for each access pattern and protect data through lifecycle policies and backup.

  • Storage Selection – Use S3 for object storage, EBS for block storage attached to a single instance, and EFS for shared file systems.
  • Lifecycle Policies – Move older objects to cheaper storage classes (e.g., S3 Standard‑IA, Glacier) automatically based on age or access patterns.
  • Backup Strategy – Use AWS Backup to centralise and automate backup policies across services, and regularly test restores.
  • Replication – Enable cross‑region replication for critical S3 buckets to support disaster recovery and compliance.
  • Encryption – Enable default encryption on S3 buckets and EBS volumes; use customer‑managed keys for sensitive data.
  • Performance Optimization – Select appropriate EBS volume types (gp3, io2) based on IOPS and throughput needs; use S3 Transfer Acceleration for large uploads.

Database Best Practices

Managed databases eliminate many operational tasks, but design choices still determine availability, performance, and recoverability.

  • Database Selection – Match the data model and consistency requirements to the right service: RDS/Aurora for relational, DynamoDB for key‑value, ElastiCache for caching.
  • High Availability – Enable Multi‑AZ deployments for RDS and Aurora to provide automatic failover during outages.
  • Read Replicas – Offload read traffic from the primary instance and improve read scalability; promote a replica to primary if needed.
  • Backup & Recovery – Enable automated backups with appropriate retention periods; test point‑in‑time recovery before you need it.
  • Connection Management – Use connection pooling and set appropriate connection limits to avoid exhausting database resources.
  • Performance Tuning – Monitor slow queries, create indexes, and use provisioned capacity or on‑demand modes appropriately in DynamoDB.

Containers & Kubernetes

Containers bring consistency across environments, but they also introduce new operational and security considerations.

  • Amazon ECS – Use ECS for simple container orchestration; separate services by task definition and use Fargate to eliminate host management.
  • Amazon EKS – Run Kubernetes when you need a standardised, multi‑cloud‑compatible orchestration layer; manage it with managed node groups.
  • Container Security – Scan images for vulnerabilities, run containers as non‑root, and use IAM roles for task/service accounts instead of long‑lived credentials.
  • Image Management – Store images in Amazon ECR, use immutable tags, and implement a promotion pipeline from dev to prod.
  • Cluster Design – Isolate workloads by namespace, set resource requests and limits, and deploy across multiple Availability Zones.
  • Scaling Containers – Use horizontal pod autoscaling in EKS or service auto scaling in ECS to adjust replica counts based on metrics.

Serverless Best Practices

Serverless architectures shift operational responsibility to AWS, but you remain responsible for function design, security, and observability.

  • AWS Lambda – Keep functions focused on a single task; use environment variables for configuration, not secrets.
  • API Gateway – Design RESTful or HTTP APIs with proper request validation, throttling, and caching.
  • EventBridge – Use it as a central event bus to decouple services and enable event‑driven workflows.
  • Step Functions – Orchestrate complex, multi‑step serverless workflows with built‑in error handling and retries.
  • Cold Start Optimization – Minimise package size, use provisioned concurrency for latency‑sensitive functions, and avoid unnecessary dependencies.
  • Event‑Driven Design – Embrace asynchronous processing; use SQS or EventBridge to buffer events rather than calling services synchronously.

Infrastructure as Code

Treating infrastructure as code brings repeatability, auditability, and collaboration to cloud provisioning.

  • AWS CloudFormation – Write templates to define your AWS resources declaratively; use nested stacks and cross‑stack references for modularity.
  • AWS CDK – Define infrastructure using familiar programming languages; leverage constructs and best‑practice defaults.
  • Terraform – Manage multi‑cloud resources with a single tool; use modules, state locking, and remote backends.
  • Version Control – Store all IaC templates in a Git repository; apply code review and branching strategies as you would for application code.
  • Automated Deployment – Run IaC changes through a CI/CD pipeline with linting, testing, and approval stages.
  • Configuration Management – Use AWS Systems Manager Parameter Store or AppConfig to manage application configuration separately from infrastructure definitions.

DevOps & CI/CD

Automating the delivery pipeline enables frequent, low‑risk deployments and reduces manual toil.

  • Continuous Integration – Automatically build and test code changes on every push; use CodeBuild or a third‑party CI tool.
  • Continuous Delivery – Package and store deployable artifacts; deploy through a pipeline that can be triggered automatically or with manual approval.
  • Deployment Strategies – Choose a strategy based on risk tolerance: all‑at‑once, rolling, blue‑green, or canary.
  • Blue‑Green Deployment – Maintain two identical environments and swap traffic after validation, enabling instant rollback.
  • Canary Deployment – Shift a small percentage of traffic to the new version first, monitor for errors, then gradually increase.
  • Rollback Strategy – Ensure you can quickly revert to the previous known‑good version if a deployment introduces issues.

Observability

Observability gives you the signals needed to understand system behaviour, detect problems, and debug effectively.

  • Monitoring – Collect metrics with CloudWatch; set alarms on key indicators like error rate, latency, and resource utilisation.
  • Logging – Centralise logs from all services using CloudWatch Logs; structure log output for easier querying.
  • Distributed Tracing – Use AWS X‑Ray or OpenTelemetry to trace requests across microservices and identify bottlenecks.
  • Metrics – Define business and operational metrics; track them alongside infrastructure metrics to correlate changes.
  • Alerting – Create actionable alerts that fire on symptoms, not just on threshold breaches; minimise noise.
  • Incident Response – Prepare runbooks, define on‑call rotations, and conduct blameless post‑mortems to learn from incidents.

Cost Optimization

Cloud cost is a design parameter, not an afterthought. The practices below help you avoid unnecessary spend.

  • Rightsizing – Regularly analyse resource utilisation and downsize or upgrade instances and databases accordingly.
  • Auto Scaling – Scale in during low‑demand periods to reduce compute cost; use scheduled scaling for predictable patterns.
  • Reserved Instances – Commit to one‑ or three‑year terms for steady‑state workloads to achieve significant discounts.
  • Savings Plans – Use flexible pricing models that apply across instance families and regions for greater coverage.
  • Storage Optimization – Move infrequently accessed data to lower‑cost storage classes; delete orphaned snapshots and volumes.
  • Cost Monitoring – Enable AWS Budgets and Cost Explorer; tag resources for granular cost allocation.
  • FinOps – Foster a culture of shared cost responsibility between engineering, finance, and business teams.

Operational Excellence

Operational excellence ensures that systems run reliably and that teams can respond effectively when things go wrong.

  • Automation – Automate repetitive operational tasks, including patching, backups, and scaling, using AWS Systems Manager and Lambda.
  • Runbooks – Document standard operating procedures and automate them where possible; store runbooks in a shared location.
  • Disaster Recovery Testing – Simulate failovers and recovery scenarios regularly to validate RPO/RTO targets and identify gaps.
  • Game Days – Conduct planned exercises that simulate failures to test team response and system resilience in a controlled manner.
  • Incident Management – Establish clear communication channels, roles, and escalation paths; use post‑incident reviews to drive improvement.
  • Continuous Improvement – Measure operational metrics (MTTD, MTTR), set improvement goals, and iterate on processes and tools.
  1. Learn Cloud Foundations.
  2. Understand AWS Concepts.
  3. Learn AWS Services.
  4. Study AWS Architecture.
  5. Apply AWS Best Practices (this section).
  6. Build and operate production‑ready cloud systems.

Continue Learning

  • AWS Concepts – The platform fundamentals that underpin every best practice.
  • AWS Services – The tools and services you’ll configure and tune with these practices.
  • AWS Architecture – The design patterns that work hand‑in‑hand with operational guidance.
  • Cloud Foundations – The universal principles that remain constant across providers.