AWS Builder Center

The Top 3 AWS Services Every Developer Needs: S3, EC2 and Lambda Explained for Production

AWS has more than 200 services, and new developers usually freeze when they first see that list. Most real-world applications run on a small core, though, and three services show up in almost every architecture I've worked with: Amazon S3, Amazon EC2 and AWS Lambda. This post covers what each service is, how to start using it, and what changes when you take it to production.

Full-Stack Engineer

1. Amazon S3 (Simple Storage Service)

What is it?

S3 is object storage. You put files (called objects) into containers (called buckets), and AWS stores them with 99.999999999% (11 nines) durability. An object can be anything: images, videos, backups, logs, static website files, or datasets for machine learning.
S3 isn't a file system you mount like a hard drive. You read and write objects over HTTP using a key, for example  invoices/2026/11/inv-1042.pdf .

Common use cases

  • Storing user uploads (profile pictures, documents)
  • Hosting static websites and frontend builds (React, Vue, Angular)
  • Backups and long-term archives
  • Data lakes for analytics
  • Storing application logs

How to use it

Create a bucket and upload a file with the AWS CLI:
bash
aws s3 mb s3://my-app-uploads-2026
aws s3 cp ./report.pdf s3://my-app-uploads-2026/reports/report.pdf
aws s3 ls s3://my-app-uploads-2026/reports/
Upload from a Python application using  boto3 :
python
import boto3

s3 = boto3.client("s3")

s3.upload_file(
Filename="report.pdf",
Bucket="my-app-uploads-2026",
Key="reports/report.pdf",
)

Using S3 in production

Keep buckets private. New buckets have Block Public Access turned on by default. Leave it on. If users need to download a private file, give them a pre-signed URL that expires:
python
url = s3.generate_presigned_url(
"get_object",
Params={"Bucket": "my-app-uploads-2026", "Key": "reports/report.pdf"},
ExpiresIn=300, # 5 minutes
)
Serve public content through CloudFront. For websites and media, put Amazon CloudFront (the CDN) in front of the bucket and use Origin Access Control so only CloudFront can read from it. You get lower latency, HTTPS and lower data transfer costs.
Turn on versioning for important buckets so a bad deploy or an accidental delete can be rolled back.
Use lifecycle rules to control cost. Move old data to cheaper storage classes automatically:
Storage class
Best for
S3 Standard
Frequently accessed data
S3 Intelligent-Tiering
Unknown or changing access patterns
S3 Standard-IA
Data read less than once a month
S3 Glacier (Instant / Flexible / Deep Archive)
Archives and compliance backups
Encrypt everything. S3 encrypts new objects by default (SSE-S3). Use SSE-KMS if you need key-level audit trails or compliance controls.
Grant least-privilege access. Your application's IAM role should only access the bucket and prefixes it actually needs, never  s3:*  on  * .



2. Amazon EC2 (Elastic Compute Cloud)

What is it?

EC2 gives you virtual servers (called instances) in the cloud. You choose the operating system, CPU, memory, storage and network settings, and you get full control of the machine, just like a server in your own data center, but you can create or delete it in minutes.

Common use cases

  • Running web servers and APIs (Node.js, Django, Spring Boot, .NET)
  • Long-running background workers
  • Self-managed databases or legacy applications
  • Workloads that need GPUs, a specific OS, or custom software

Choosing an instance type

Instance types are grouped into families:
Family
Optimized for
Example
T (burstable)
Small apps, dev/test
 t3.micro ,  t4g.small 
M (general purpose)
Balanced web apps
 m7i.large ,  m7g.large 
C (compute)
CPU-heavy work
 c7g.xlarge 
R (memory)
Caches, in-memory data
 r7i.large 
G / P (accelerated)
ML and graphics
 g5.xlarge 
The  g  in names like  m7g  means AWS Graviton (ARM) processors, which usually give better price-performance if your stack supports ARM.

How to use it

Launch an instance from the CLI:
bash
aws ec2 run-instances \
--image-id ami-xxxxxxxxxxxxxxxxx \
--instance-type t3.micro \
--key-name my-key \
--security-group-ids sg-xxxxxxxx \
--subnet-id subnet-xxxxxxxx
Then connect, install your runtime, and deploy your application. For a quick start you can also use the EC2 console's "Launch instance" wizard.

Using EC2 in production

A single EC2 instance is fine for learning. In production, a single instance is a single point of failure. A typical production setup looks like this:
  1. Launch Template: defines the AMI, instance type, IAM role and startup script.
  1. Auto Scaling Group (ASG): runs instances across at least two Availability Zones and replaces unhealthy ones automatically. Scale on metrics like CPU usage or request count.
  1. Application Load Balancer (ALB): spreads traffic across instances, runs health checks and terminates HTTPS using a free certificate from AWS Certificate Manager.
Other production practices:
  • Put instances in private subnets. Only the load balancer should be public. Use a NAT gateway for outbound internet access.
  • Skip SSH keys and open port 22. Use AWS Systems Manager Session Manager to access instances securely.
  • Attach an IAM role to the instance. Never store AWS access keys on the server.
  • Bake your AMIs (with EC2 Image Builder or Packer) so new instances start fast and identical.
  • Monitor with CloudWatch. Collect logs and memory metrics with the CloudWatch agent, and set alarms.
  • Optimize cost. Use Savings Plans for steady workloads and Spot Instances (up to 90% cheaper) for fault-tolerant jobs like batch processing.
  • Back up EBS volumes with snapshots via AWS Backup.



3. AWS Lambda

What is it?

Lambda runs your code without you managing any servers. You upload a function, connect it to an event, and AWS runs it whenever that event happens. You pay only for the number of requests and the compute time used, billed by the millisecond. When nothing is happening, you pay nothing.
Lambda supports Python, Node.js, Java, .NET, Ruby and custom runtimes, including container images.

Common use cases

  • REST APIs (with Amazon API Gateway)
  • Processing files when they land in S3 (resize images, parse CSVs)
  • Scheduled jobs (cron) with Amazon EventBridge
  • Processing messages from SQS queues or DynamoDB streams
  • Glue code between AWS services

How to use it

A simple Python function that runs every time a file is uploaded to S3:
python
import json
import urllib.parse

def lambda_handler(event, context):
for record in event["Records"]:
bucket = record["s3"]["bucket"]["name"]
key = urllib.parse.unquote_plus(record["s3"]["object"]["key"])
print(f"New file uploaded: s3://{bucket}/{key}")
# process the file here: resize, scan, parse...

return {"statusCode": 200, "body": json.dumps("Processed")}
Create the function in the Lambda console, paste the code, then add an S3 trigger on your bucket. Every upload now calls your function automatically.

Limits you should know

  • Maximum run time: 15 minutes per invocation
  • Memory: 128 MB to 10,240 MB (CPU scales with memory)
  • Temporary disk ( /tmp ): up to 10 GB
If your task runs longer than 15 minutes, use EC2, ECS/Fargate or AWS Step Functions instead.

Using Lambda in production

  • Use Infrastructure as Code. Define functions with AWS SAM, AWS CDK, Serverless Framework or Terraform rather than clicking in the console, so every environment is reproducible.
  • Give each function its own IAM role with only the permissions it needs.
  • Handle failures. Configure retries, and send failed events to a dead-letter queue (SQS) or an on-failure destination so nothing is silently lost.
  • Make functions idempotent. Events can be delivered more than once, so processing the same event twice must be safe.
  • Reduce cold starts. Keep deployment packages small, initialize SDK clients outside the handler, and use Provisioned Concurrency or SnapStart for latency-sensitive APIs.
  • Tune memory. More memory also means more CPU, and sometimes a higher memory setting is both faster and cheaper. The open-source AWS Lambda Power Tuning tool helps find the sweet spot.
  • Set reserved concurrency to protect downstream systems like databases from being overwhelmed during traffic spikes.
  • Store secrets safely in AWS Secrets Manager or SSM Parameter Store, not in plain environment variables.
  • Observe everything. Use CloudWatch Logs with structured (JSON) logging, CloudWatch alarms on errors and throttles, and AWS X-Ray for tracing.



How the Three Work Together

These services are most useful in combination. Here's a common image-processing architecture:
  1. A user uploads a photo through a web app running on EC2 behind a load balancer.
  1. The app stores the original image in S3.
  1. The upload triggers a Lambda function that creates thumbnails.
  1. The thumbnails are saved back to S3 and served to users through CloudFront.
EC2 handles the always-on application, S3 stores the files, and Lambda does event-driven work only when it's needed.

Which One Should You Use?

Need
Use
Store files, backups or static websites
S3
Full control of the server, long-running processes
EC2
Short, event-driven tasks with no server management
Lambda

Conclusion

If you learn S3, EC2 and Lambda well, you can build most applications on AWS. Start small: host a static site on S3, deploy an API on EC2, and write a Lambda function that reacts to an S3 upload. Once those work, add the production practices above: least-privilege IAM, multi-AZ deployments, monitoring, and Infrastructure as Code.
If you have questions or want me to cover any of these services in more depth, leave a comment below.
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article