Cloud Service Management
Cloud Service Management
ENGINEERING COLLEGE
OWNED AND MANAGED BY TAMILNADU EDUCATIONAL AND MEDICAL TRUST
LABORATORY RECORD
CLASS : ……………………………………………
1
COLLEGE
VISION :
MISSION :
2
MISRIMAL NAVAJEE MUNOTH JAIN
ENGINEERING COLLEGE
OWNED AND MANAGED BY TAMILNADU EDUCATIONAL AND MEDICAL TRUST
THORAPAKKAM , CHENNAI - 600 097.
Certificate that this is a bonafide record of the work done by the above student in
the CCS366 CLOUD SERVICE MANAGEMENT Laboratory during the
year 2025.
Date:
3
INDEX
S.No. DATE NAME OF THE EXPERIMENT PAGE SIGNATURE
Create a Cloud Organization in
AWS/Google Cloud/or any
01. 21/02/25 equivalent Open-Source cloud 06-08
software’s like OpenStack,
Eucalyptus, Open Nebula with
Role-based access control.
4
CCS366
5
Ex. No. 01 CREATE A CLOUD ORGANIZATION IN
AWS/GOOGLE CLOUD/OR ANY EQUIVALENT
OPEN-SOURCE CLOUD SOFTWARE’S LIKE
DATE: 2 1 / 0 2 / 2 5 OPENSTACK, EUCALYPTUS, OPEN NEBULA WITH
ROLE-BASED ACCESS CONTROL
AIM:
PROCEDURE:
STEP 1: Creating a cloud organization with role-based access control involves setting
up a hierarchy of users, groups, and roles to manage permissions effectively.
STEP 2: One way to create a cloud organization with role-based access control in
AWS is done using AWS Identity and Access Management (IAM).
STEP 3: We can adapt the concepts to other cloud providers or open-source cloud
software with similar capabilities.
SOURCE CODE:
1. import boto3
2. # Initialize AWS IAM client
3. iam = boto3.client('iam')
4. # Define policies
5. policy_document = {
6. "Version": "2012-10-17",
7. "Statement": [{
8. "Effect": "Allow",
9. "Action": "s3:*",
10. "Resource": "*"
11. }]
6
12. }
13. # Create policies
14. s3_policy = iam.create_policy(
15. PolicyName='S3FullAccess',
16. PolicyDocument=str(policy_document)
17. )
18. # Create a group
19. group_response = iam.create_group(
20. GroupName='MyGroup'
21. )
22. # Attach policy to the group
23. iam.attach_group_policy(
24. GroupName='MyGroup',
25. PolicyArn=s3_policy['Policy']['Arn']
26. )
27. # Create a new IAM user
28. user_response = iam.create_user(
29. UserName='MyUser'
30. )
31. # Add the user to the group
32. iam.add_user_to_group(
33. GroupName='MyGroup',
34. UserName='MyUser'
35. )
36. print("Organization created successfully!")
7
OUTPUT:
RESULT:
8
Ex. No. 02
CREATE A COST-MODEL FOR A WEB
APPLICATION USING VARIOUS SERVICES AND DO
DATE: 0 7 / 0 3 / 2 5 COST-BENEFIT ANALYSIS
AIM:
To create a cost model for a web application using cloud services and perform
cost-benefit analysis
PROCEDURE:
STEP 1: Creating a cost model for a web application using cloud services involves
estimating the expenses associated with various components and services utilized in
the application.
STEP 2: Building a cost model for a typical web application using a combination of
AWS (Amazon Web Services) and Google Cloud Platform (GCP) services is
considered.
STEP 3: Specific pricing information may change over time, and we need to check the
respective cloud providers for up-to-date pricing.
SOURCE CODE:
9
7. }
8. # Define the usage of each service
9. service_usage = {
10. "Compute": 1, # Number of virtual machine
instances
11. "Storage": 100, # Amount of storage in GB
12. "Database": 1, # Number of database
instances
13. # Add more services as needed
14. }
15. # Calculate the total cost of each service in
Indian Rupees
16. total_costs_inr = {service:
service_costs_inr[service] * service_usage[service]
for service in service_costs_inr}
17. # Calculate the total cost of all services
combined in Indian Rupees
18. total_cost_inr = sum(total_costs_inr.values())
19. # Perform cost-benefit analysis (e.g., compare
cost to potential revenue or savings)
20. # For simplicity, let's assume a fixed revenue
or savings value in INR
21. revenue_or_savings_inr = 75000 # Example
revenue or savings in Indian Rupees
22. # Determine if the cost is justified based on
the revenue or savings
23. if total_cost_inr <= revenue_or_savings_inr:
24. print("The cost of the services is justified.")
25. else:
26. print("The cost of the services exceeds the
potential revenue or savings.")
10
27. # Print the detailed cost breakdown in Indian
Rupees
28. print("Detailed cost breakdown (in Indian
Rupees):")
29. for service, cost_inr in
total_costs_inr.items():
30. print("{}: INR {:.2f}".format(service,
cost_inr))
31. print("Total Cost: INR
{:.2f}".format(total_cost_inr))
OUTPUT:
RESULT:
Thus, we have created a cost model for a web application using cloud services
and perform cost-benefit analysis which was executed and verified successfully.
11
Ex. No. 03
CREATE ALERTS FOR USAGE OF CLOUD
RESOURCES
DATE: 28/03/25
AIM:
PROCEDURE:
1. Define Metrics: Identify the key metrics you want to monitor for your cloud
resources, such as CPU utilization, memory usage, disk I/O, network traffic,
etc.
2. Set Thresholds: Determine threshold levels for each metric that indicate when
an alert should be triggered. For example, you might set a threshold of 90%
CPU utilization to trigger a CPU alert.
3. Monitor Metrics: Continuously monitor the selected metrics using monitoring
tools provided by the cloud platform or third-party monitoring services.
4. Check Thresholds: Regularly compare the current metric values to the
predefined thresholds.
5. Trigger Alerts: If any metric value exceeds its threshold, trigger an alert.
6. Notify Users: Send notifications to relevant stakeholders (e.g., system
administrators, DevOps team) via email, SMS, or other communication
channels, informing them of the alert and providing details about the resource
and the metric that triggered it.
7. Take Action: Depending on the severity of the alert and the established
procedures, take appropriate actions to address the issue. This could involve
scaling resources, reallocating resources, investigating the root cause of the
problem, or executing remediation scripts.
8. Resolve Alert: Once the issue has been addressed, mark the alert as resolved
and update any incident documentation or status boards.
9. Review Alerts: Periodically review alert history and patterns to identify
recurring issues, adjust thresholds if necessary, and optimize the alerting
system for better efficiency and accuracy.
10. Document Process: Document the alerting process, including the metrics
monitored, thresholds set, notification procedures, and response actions. Ensure
that all team members are familiar with the alerting process and know how to
respond to alerts effectively.
12
SOURCE CODE:
1. import boto3
2. def create_cloudwatch_alarm(instance_id, threshold,
evaluation_periods, email):
3. # Initialize the CloudWatch client
4. cloudwatch = boto3.client('cloudwatch')
5. # Define the alarm name
6. alarm_name =
"{}_CPU_Utilization_Alarm".format(instance_id)
7. # Create the alarm
8. response = cloudwatch.put_metric_alarm(
9. AlarmName=alarm_name,
10. ComparisonOperator='GreaterThanThreshold',
11. EvaluationPeriods=evaluation_periods,
12. MetricName='CPUUtilization',
13. Namespace='AWS/EC2',
14. Period=60, # 1 minute
15. Statistic='Average',
16. Threshold=threshold, # CPU threshold
(percentage)
17. ActionsEnabled=True,
18. AlarmActions=[
a. 'arn:aws:sns:us-east-1:123456789012:MyTopic' #
Replace with your SNS topic ARN
19. ],
20. AlarmDescription='Alarm when CPU exceeds {}% for
{} period(s)'.format(threshold, evaluation_periods),
21. Dimensions=[
a. {
b. 'Name': 'InstanceId',
c. 'Value': instance_id
d. },
22. ],
23. Unit='Percent'
24. )
25. print("CloudWatch alarm created successfully:",
response)
26. # Example usage
27. if name == " main ":
28. # Input parameters
13
29. instance_id = raw_input("Enter EC2 instance ID:
") # Use input() in Python 3.x
30. threshold = float(raw_input("Enter CPU
utilization threshold (percentage): ")) # Use
input() in Python 3.x
31. evaluation_periods = int(raw_input("Enter number
of evaluation periods: ")) # Use input() in Python
3.x
32. email = raw_input("Enter email address for
notification: ") # Use input() in Python 3.x
33. # Create CloudWatch alarm
34. create_cloudwatch_alarm(instance_id, threshold,
evaluation_periods, email)
OUTPUT:
RESULT:
Thus, we have created alerts for the usage of cloud resources which was
executed and verified successfully.
14
Ex. No. 04
CREATE BILLING ALERTS FOR YOUR CLOUD
ORGANIZATION
DATE: 11/04/25
AIM:
To Create billing alerts for a cloud organization with suitable algorithm, source
code, output, result.
PROCEDURE:
15
thresholds, alert mechanisms, recipients, and any relevant policies or
procedures. Ensure that all stakeholders are aware of the billing alerting system
and know how to respond to alerts effectively.
SOURCE CODE:
1. import boto3
2. def create_billing_alarm(threshold_amount,
email_address):
3. # Initialize the CloudWatch client
4. cloudwatch = boto3.client('cloudwatch')
5. # Define the alarm name
6. alarm_name = 'BillingAlarm'
7. # Create the alarm
8. response = cloudwatch.put_metric_alarm(
9. AlarmName=alarm_name,
10. ComparisonOperator='GreaterThanThreshold',
11. EvaluationPeriods=1,
12. MetricName='EstimatedCharges',
13. Namespace='AWS/Billing',
14. Period=86400, # 1 day (in seconds)
15. Statistic='Maximum',
16. Threshold=threshold_amount,
17. ActionsEnabled=True,
18. AlarmActions=[
19. 'arn:aws:sns:us-east-1:123456789012:MyTopic' #
Replace with your SNS topic ARN
20. ],
21. AlarmDescription='Alarm when estimated charges
exceed ${}'.format(threshold_amount),
22. Dimensions=[
23. {
24. 'Name': 'Currency',
16
25. 'Value': 'USD'
26. }
27. ],
28. Unit='None'
29. )
30. print("Billing alarm created successfully:",
response)
31. # Example usage
32. if name == " main ":
33. # Input parameters
34. threshold_amount = float(input("Enter billing
threshold amount (USD): "))
35. email_address = input("Enter email address for
notification: ")
36. # Create billing alarm
37. create_billing_alarm(threshold_amount,
email_address)
OUTPUT:
RESULT:
Thus, we have created billing alerts for a cloud organization which was
executed and verified successfully.
17
Ex. No. 05
COMPARE CLOUD COST FOR A SIMPLE WEB
APPLICATION ACROSS AWS, AZURE AND GCP
DATE: 0 2 / 0 5 / 2 5 AND SUGGEST THE BEST ONE
AIM:
To compare the cloud costs across different providers (AWS, Azure, and GCP)
for a simple web application.
PROCEDURE:
18
interoperability with other services or platforms.
10. Make a Decision: Based on the cost comparison, as well as other factors such
as performance, reliability, and ease of use, make an informed decision about
the best cloud provider for your simple web application.
SOURCE CODE:
1. # AWS Pricing
2. aws_vm_cost_per_hour = 0.05 # Cost per hour for a
t2.micro instance (example)
3. aws_storage_cost_per_gb_month = 0.1 # Cost per GB
per month for storage (example)
4. aws_data_transfer_cost_per_gb = 0.12 # Cost per GB
for data transfer (example)
5. # Azure Pricing
6. azure_vm_cost_per_hour = 0.06 # Cost per hour for a
Standard_B1s instance (example)
7. azure_storage_cost_per_gb_month = 0.11 # Cost per GB
per month for storage (example)
8. azure_data_transfer_cost_per_gb = 0.10 # Cost per GB
for data transfer (example)
9. # GCP Pricing
10. gcp_vm_cost_per_hour = 0.0475 # Cost per hour
for a e2-medium instance (example)
11. gcp_storage_cost_per_gb_month = 0.09 # Cost per
GB per month for storage (example)
12. gcp_data_transfer_cost_per_gb = 0.11 # Cost per
GB for data transfer (example)
13. # Web application requirements
14. num_instances = 2 # Number of instances
required
15. storage_gb = 100 # Storage required in GB
16. data_transfer_gb = 1000 # Data transfer
required in GB
17. # Calculate costs for AWS
18. aws_vm_cost_monthly = aws_vm_cost_per_hour * 24
* 30 * num_instances
19. aws_storage_cost_monthly =
aws_storage_cost_per_gb_month * storage_gb
19
20. aws_data_transfer_cost_monthly =
aws_data_transfer_cost_per_gb * data_transfer_gb
21. aws_total_cost_monthly = aws_vm_cost_monthly +
aws_storage_cost_monthly
aws_data_transfer_cost_monthly
22. # Calculate costs for Azure
23. azure_vm_cost_monthly = azure_vm_cost_per_hour *
24 * 30 * num_instances
24. azure_storage_cost_monthly =
azure_storage_cost_per_gb_month * storage_gb
25. azure_data_transfer_cost_monthly =
azure_data_transfer_cost_per_gb * data_transfer_gb
26. azure_total_cost_monthly = azure_vm_cost_monthly
+ azure_storage_cost_monthly +
azure_data_transfer_cost_monthly
27. # Calculate costs for GCP
28. gcp_vm_cost_monthly = gcp_vm_cost_per_hour * 24
* 30 * num_instances
29. gcp_storage_cost_monthly =
gcp_storage_cost_per_gb_month * storage_gb
30. gcp_data_transfer_cost_monthly =
gcp_data_transfer_cost_per_gb * data_transfer_gb
31. gcp_total_cost_monthly = gcp_vm_cost_monthly +
gcp_storage_cost_monthly +
gcp_data_transfer_cost_monthly
32. # Print costs for each cloud platform
33. print("AWS Monthly Cost: $",
aws_total_cost_monthly)
34. print("Azure Monthly Cost: $",
azure_total_cost_monthly)
35. print("GCP Monthly Cost: $",
gcp_total_cost_monthly)
36. # Compare costs and suggest the best option
37. min_cost = min(aws_total_cost_monthly,
azure_total_cost_monthly, gcp_total_cost_monthly)
38. if min_cost == aws_total_cost_monthly:
39. print("AWS is the most cost-effective option.")
40. elif min_cost == azure_total_cost_monthly:
41. print("Azure is the most cost-effective
option.")
42. else:
20
43. print("GCP is the most cost-effective option.")
OUTPUT:
RESULT:
Thus, we have compared the cloud costs across different providers (AWS,
Azure, and GCP) for a simple web application which was executed and verified
successfully.
21