ASSIGNMENT 2
OBJECTIVE: To understand and utilize cloud storage services provided by AWS/
zure
A
1. Login to your AWS Console.
Go to EC2 → Instances → Launch Instance
AMI: Select “Ubuntu Server 22.04 LTS (Free Tier Eligible)”
Key Pair: Create new OR use existing
File format: .pem (download and save safely)
Launch Instance
2. Connect via SSH Using command prompt
3. Create IAM User with S3 Full Access
Copy paste access key and secret key for future use
4. AWS CLI Configure on EC2
5. Create an S3 Bucket
6. Python Script to Backup File to S3
notepad file is created
A
Paste the following code in notepad
import boto3
from botocore.exceptions import NoCredentialsError
s3 = boto3.client('s3')
ucket_name = 'anushka-backup-bucket-2025'
b
file_name = 'backup.txt'
object_name = 'backup.txt'
try:
s3.upload_file(file_name, bucket_name, object_name)
print(f"Upload Successful: {object_name}")
except FileNotFoundError:
print("The file was not found")
except NoCredentialsError:
print("Credentials not available")
7. Verify File in S3 Bucket
8. Retrieve File from S3 to EC2