Full Guide to understand AWS Dr Benabderrezak
1. What is AWS ?
Amazon Web Services (AWS) is a cloud platform providing on-demand computing resources like :
● Servers
● Storage
● Databases
● Networking
● Security
● Machine Learning
● Developer Tools
2. Why AWS ?
● Scalability : Resources grow with your project.
● Pay-as-you-go : No upfront costs.
● High Availability : Global infrastructure.
● Wide Services : Supports web hosting, backups, AI, IoT, etc.
3. Core AWS Services to Master
● EC2 (Elastic Compute Cloud) : Virtual servers.
● S3 (Simple Storage Service) : File and object storage.
● RDS (Relational Database Service) : Managed SQL databases.
● VPC (Virtual Private Cloud) : Private networking.
● IAM (Identity and Access Management) : Permissions and security.
● CloudWatch : Monitoring and logging.
● Route 53 : DNS management.
● Lambda : Serverless functions.
● ECS/EKS : Container services.
● CloudFormation : Infrastructure as code.
1
Full Guide to understand AWS Dr Benabderrezak
4. Step-by-Step Labs
Lab 1 : Launch EC2 Server
1. Go to EC2 Dashboard > Launch Instance
2. Select Ubuntu Server 22.04 LTS
3. Choose [Link] (Free Tier)
4. Create new key pair → Download it
5. Configure security group → Allow SSH (port 22), HTTP (port 80)
6. Launch Instance
Connect via SSH :
- chmod 400 [Link]
- ssh -i [Link] ubuntu@your-ec2-public-ip
Lab 2 : Upload Files to S3 Bucket
1. Go to S3 Dashboard > Create Bucket.
2. Choose region, disable public access.
3. Upload file via GUI or CLI.
AWS CLI Example :
- aws s3 mb s3 ://my-document-bucket
- aws s3 cp [Link] s3 ://my-document-bucket
Lab 3 : Set up a Database with RDS
1. Go to RDS Dashboard > Create Database.
2. Choose MySQL, free tier.
3. Create admin user/password.
4. Configure public access (optional)
5. Connect using MySQL client : mysql -h your-rds-endpoint -u admin -p
2
Full Guide to understand AWS Dr Benabderrezak
Lab 4 : Configure IAM for Secure Access
1. Go to IAM Dashboard > Users > Add User.
2. Assign programmatic access.
3. Attach policy (e.g., AmazonS3ReadOnlyAccess).
4. Download access key.
CLI Example :
aws configure
# Enter Access Key, Secret Key, Region, Output format
Lab 5 : Build a Simple Website with EC2 + S3
1. Upload HTML files to S3 bucket.
2. Enable static website hosting.
3. Update bucket policy for public access.
4. Optionally, point Route 53 domain to the S3 website.
Lab 6 : Automate Monitoring with CloudWatch
1. Go to CloudWatch Dashboard.
2. Set alarms for CPU usage > 80%.
3. Configure email/SMS notifications.
Lab 7 : Build Serverless API with Lambda
1. Go to Lambda Dashboard > Create Function.
2. Write Python/[Link] handler.
3. Add API Gateway trigger to expose as HTTP endpoint.
Lab 8 : Secure Your Network with VPC
1. Go to VPC Dashboard > Create VPC.
2. Add subnets (public and private).
3. Configure security groups and routing.
3
Full Guide to understand AWS Dr Benabderrezak
Lab 9 : Docker with AWS ECS
1. Push Docker image to Amazon ECR.
2. Create ECS Cluster.
3. Deploy service using the Docker image.
Lab 10 : Infrastructure as Code with CloudFormation
1. Write YAML/JSON CloudFormation template.
2. Go to CloudFormation Dashboard > Create Stack.
3. Review and launch stack.
5. Security Best Practices
● Never store AWS secret keys in code.
● Use IAM roles with minimal permissions.
● Enable Multi-Factor Authentication (MFA).
● Regularly audit logs with CloudTrail.
● Encrypt S3 buckets and RDS storage.
6. AWS Certifications Path (Optional)
1. Cloud Practitioner (Beginner)
2. Solutions Architect - Associate (Intermediate)
3. DevOps Engineer - Professional (Advanced)
7. AWS Tools to Explore
● AWS CLI
● AWS SDK (Python, [Link], etc.)
● AWS Cloud9 IDE
● AWS CodePipeline (CI/CD)
● AWS Amplify (Web hosting)
4
Full Guide to understand AWS Dr Benabderrezak
Full Guide : AWS API Integration with Laravel
1. Prerequisites
● Laravel 11 installed
● AWS account
● IAM user with proper permissions
● AWS SDK for PHP installed
2. Install AWS SDK in Laravel
composer require aws/aws-sdk-php
3. Configure AWS Credentials
In .env file :
● AWS_ACCESS_KEY_ID=your-access-key
● AWS_SECRET_ACCESS_KEY=your-secret-key
● AWS_DEFAULT_REGION=us-east-1
● AWS_BUCKET=your-s3-bucket-name
In config/[Link] :
's3' => [
'driver' => 's3',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION'),
'bucket' => env('AWS_BUCKET'),
'url' => env('AWS_URL'),
],
5
Full Guide to understand AWS Dr Benabderrezak
4. Common AWS Services Integration
4.1. S3 (File Upload & Download)
Upload File to S3
use Illuminate\Support\Facades\Storage;
public function upload(Request $request)
$path = Storage::disk('s3')->put('documents', $request->file('document'));
$url = Storage::disk('s3')->url($path);
return response()->json(['url' => $url]);
Download File from S3
public function download($filename)
return Storage::disk('s3')->download('documents/' . $filename);
4.2. SES (Amazon Simple Email Service)
Setup Mail in .env
MAIL_MAILER=smtp
MAIL_HOST=[Link]
MAIL_PORT=587
MAIL_USERNAME=your-smtp-username
6
Full Guide to understand AWS Dr Benabderrezak
MAIL_PASSWORD=your-smtp-password
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=you@[Link]
MAIL_FROM_NAME="${APP_NAME}"
Sending Email
use Illuminate\Support\Facades\Mail;
Mail::raw('This is a test email via Amazon SES.', function ($message) {
$message->to('recipient@[Link]')->subject('AWS SES Email');
});
4.3. DynamoDB (NoSQL Database)
Install AWS SDK
composer require aws/aws-sdk-php
Store Data Example
use Aws\DynamoDb\DynamoDbClient;
public function storeInDynamoDB()
$client = new DynamoDbClient([
'region' => 'us-east-1',
'version' => 'latest',
'credentials' => [
'key' => env('AWS_ACCESS_KEY_ID'),
7
Full Guide to understand AWS Dr Benabderrezak
'secret' => env('AWS_SECRET_ACCESS_KEY'),
]);
$client->putItem([
'TableName' => 'Documents',
'Item' => [
'DocumentID' => ['S' => 'DOC001'],
'Owner' => ['S' => 'User1'],
'Timestamp' => ['N' => time()],
]);
return response('Document stored in DynamoDB');
4.4. SQS (Simple Queue Service)
Send Message to Queue
use Aws\Sqs\SqsClient;
public function sendMessage()
$client = new SqsClient([
'region' => 'us-east-1',
'version' => 'latest',
8
Full Guide to understand AWS Dr Benabderrezak
'credentials' => [
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
]);
$result = $client->sendMessage([
'QueueUrl' => '[Link]
'MessageBody' => 'Hello from Laravel!',
]);
return response()->json($result->toArray());
4.5. CloudWatch (Logging)
Send Logs to CloudWatch
use Aws\CloudWatchLogs\CloudWatchLogsClient;
public function logEvent()
$client = new CloudWatchLogsClient([
'region' => 'us-east-1',
'version' => 'latest',
'credentials' => [
'key' => env('AWS_ACCESS_KEY_ID'),
9
Full Guide to understand AWS Dr Benabderrezak
'secret' => env('AWS_SECRET_ACCESS_KEY'),
]);
// You must first create log group and stream in AWS console or via API.
$client->putLogEvents([
'logGroupName' => 'laravel-logs',
'logStreamName' => 'document-stream',
'logEvents' => [
'timestamp' => round(microtime(true) * 1000),
'message' => 'New document issued at ' . now(),
],
],
]);
return response('Log sent to CloudWatch');
5. Laravel API Structure Example
use App\Http\Controllers\AwsController;
Route::prefix('aws')->controller(AwsController::class)->group(function () {
Route::post('/upload', 'upload');
Route::get('/download/{filename}', 'download');
10
Full Guide to understand AWS Dr Benabderrezak
Route::post('/send-email', 'sendEmail');
Route::post('/dynamodb', 'storeInDynamoDB');
Route::post('/send-sqs', 'sendMessage');
Route::post('/log-cloudwatch', 'logEvent');
});
6. Optional: AWS SDK via Laravel Package
You can use the package:
composer require aws/aws-sdk-php-laravel
Then add to config/[Link]:
'providers' => [
Aws\Laravel\AwsServiceProvider::class,
],
'aliases' => [
'AWS' => Aws\Laravel\AwsFacade::class,
],
11