Master AWS cloud fundamentals with our comprehensive tutorial. Learn EC2, S3, RDS, Lambda, and infrastructure management through practical examples.
Cloud computing provides on-demand access to computing resources over the internet. AWS (Amazon Web Services) is the world's most comprehensive and broadly adopted cloud platform, offering over 200 services.
# Cloud Service Models
IaaS - Infrastructure as a Service (EC2, VPC)
PaaS - Platform as a Service (Elastic Beanstalk)
SaaS - Software as a Service (Gmail, Salesforce)
# Cloud Deployment Models
Public Cloud - AWS, Azure, GCP
Private Cloud - On-premises
Hybrid Cloud - Combination of bothUnderstanding cloud computing fundamentals
The AWS Command Line Interface (CLI) is a unified tool to manage AWS services. With just one tool, you can control multiple AWS services from the command line.
# Install AWS CLI
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/installInstall AWS CLI on Linux
# Configure AWS CLI
aws configure
# Enter: Access Key ID
# Enter: Secret Access Key
# Enter: Default region (e.g., us-east-1)
# Enter: Default output format (json)Configure AWS credentials and default settings
# Verify configuration
aws sts get-caller-identityCheck your AWS identity and credentials
EC2 provides scalable computing capacity in the cloud. You can launch virtual servers, configure security and networking, and manage storage.
# List EC2 instances
aws ec2 describe-instancesView all EC2 instances in your account
# Launch an EC2 instance
aws ec2 run-instances \
--image-id ami-0c55b159cbfafe1f0 \
--instance-type t2.micro \
--key-name MyKeyPair \
--security-group-ids sg-0123456789abcdef0 \
--subnet-id subnet-0123456789abcdef0Launch a new EC2 instance --image-id: AMI ID --instance-type: Instance size --key-name: SSH key pair
# Stop an instance
aws ec2 stop-instances --instance-ids i-1234567890abcdef0
# Start an instance
aws ec2 start-instances --instance-ids i-1234567890abcdef0
# Terminate an instance
aws ec2 terminate-instances --instance-ids i-1234567890abcdef0Manage EC2 instance lifecycle
S3 is object storage built to store and retrieve any amount of data from anywhere. It's designed for 99.999999999% durability.
# Create an S3 bucket
aws s3 mb s3://my-unique-bucket-nameCreate a new S3 bucket (name must be globally unique)
# List all buckets
aws s3 ls
# List contents of a bucket
aws s3 ls s3://my-bucket-nameList S3 buckets and their contents
# Upload a file
aws s3 cp myfile.txt s3://my-bucket-name/
# Download a file
aws s3 cp s3://my-bucket-name/myfile.txt ./
# Sync a directory
aws s3 sync ./local-folder s3://my-bucket-name/remote-folderUpload, download, and sync files with S3
# Delete a file
aws s3 rm s3://my-bucket-name/myfile.txt
# Delete a bucket (must be empty)
aws s3 rb s3://my-bucket-nameRemove files and buckets
IAM enables you to manage access to AWS services and resources securely. You can create and manage AWS users and groups, and use permissions to allow and deny access.
# List IAM users
aws iam list-users
# Create a new user
aws iam create-user --user-name john-doeManage IAM users
# Create an access key for a user
aws iam create-access-key --user-name john-doeGenerate access keys for programmatic access
# Attach a policy to a user
aws iam attach-user-policy \
--user-name john-doe \
--policy-arn arn:aws:iam::aws:policy/AmazonS3ReadOnlyAccessGrant permissions using managed policies
RDS makes it easy to set up, operate, and scale a relational database in the cloud. It supports MySQL, PostgreSQL, Oracle, SQL Server, and more.
# List RDS instances
aws rds describe-db-instancesView all RDS database instances
# Create a MySQL database
aws rds create-db-instance \
--db-instance-identifier mydb \
--db-instance-class db.t3.micro \
--engine mysql \
--master-username admin \
--master-user-password MyPassword123 \
--allocated-storage 20Create a new RDS MySQL database --db-instance-class: Instance size --allocated-storage: Storage in GB
# Create a database snapshot
aws rds create-db-snapshot \
--db-instance-identifier mydb \
--db-snapshot-identifier mydb-snapshot-2024Create a backup snapshot of your database
Lambda lets you run code without provisioning or managing servers. You pay only for the compute time you consume.
# List Lambda functions
aws lambda list-functionsView all Lambda functions in your account
# Create a Lambda function
aws lambda create-function \
--function-name my-function \
--runtime nodejs18.x \
--role arn:aws:iam::123456789012:role/lambda-role \
--handler index.handler \
--zip-file fileb://function.zipCreate a new Lambda function --runtime: Programming language --handler: Entry point
# Invoke a Lambda function
aws lambda invoke \
--function-name my-function \
--payload '{"key":"value"}' \
response.jsonExecute a Lambda function and get response
CloudFormation provides a common language to describe and provision all infrastructure resources in your cloud environment using templates.
# Create a stack from a template
aws cloudformation create-stack \
--stack-name my-stack \
--template-body file://template.yaml \
--parameters ParameterKey=KeyName,ParameterValue=MyKeyDeploy infrastructure using CloudFormation template
# List all stacks
aws cloudformation list-stacks
# Describe a stack
aws cloudformation describe-stacks --stack-name my-stackView CloudFormation stacks and their status
# Update a stack
aws cloudformation update-stack \
--stack-name my-stack \
--template-body file://updated-template.yaml
# Delete a stack
aws cloudformation delete-stack --stack-name my-stackUpdate or delete CloudFormation stacks