0% found this document useful (0 votes)
2 views

CSM Lab Manual

The document outlines various exercises related to cloud computing, including creating a cloud organization in AWS with role-based access control, developing a cost model for a web application, setting up alerts for cloud resource usage and billing, and comparing cloud costs across AWS, Azure, and GCP. Each exercise includes specific procedures and programming examples to achieve the desired outcomes. The results indicate successful implementation of each task.

Uploaded by

siva8k143
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

CSM Lab Manual

The document outlines various exercises related to cloud computing, including creating a cloud organization in AWS with role-based access control, developing a cost model for a web application, setting up alerts for cloud resource usage and billing, and comparing cloud costs across AWS, Azure, and GCP. Each exercise includes specific procedures and programming examples to achieve the desired outcomes. The results indicate successful implementation of each task.

Uploaded by

siva8k143
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

EX.

NO:01 Create a Cloud Organization in AWS/Google Cloud/or any equivalent Open-Source


cloud software like OpenStack, Eucalyptus, Open Nebula with Role-based access
Date: control

Aim:
To create a Cloud Organization in AWS with Roll-based access control.

Procedure:
To create an organization in AWS with role-based access, you can follow these general steps:
1. Create an AWS account: If you don't already have an AWS account, you'll need to create one. This will
be your management account and the root of your organization.

2. Enable AWS Organizations: From the AWS Management Console, navigate to the AWS
Organizations service and enable it. This will create the organization with your management account
as the master account.
3. Create OUs (Organizational Units): You can create one or more OUs to organize your accounts.
For example, you might create separate OUs for different departments or environments (e.g.,
production, staging, development).

4. Create member accounts: You can create new AWS accounts and invite existing accounts to join
your organization as member accounts. You can add these accounts to the appropriate OUs.

5. Create service control policies (SCPs): SCPs are policies that you can attach to OUs or individual
accounts to define the maximum set of actions that can be performed on resources in those OUs or
accounts. This allows you to enforce role-based access and other security policies across your
organization.

6. Assign IAM roles: You can create IAM roles in your management account and delegate specific
permissions to them. You can then assume these roles from your member accounts to perform actions
on resources in the management account or other member accounts.

7. Configure permissions: You can use IAM policies to control access to AWS services and resources.
You can attach these policies to IAM users, groups, or roles in your management account or
member accounts.
To create a role with specific permissions, you can follow these steps:
• Open the IAM console in your management account.
• Create a new role and choose the appropriate trusted entity (e.g., another AWS account, an AWS service,
or your AWS Organizations).
• Define the permissions for the role by attaching an IAM policy or a service control policy (SCP).
• Save the role and note down the ARN (Amazon Resource Name) of the role.
• In the AWS Organizations console, attach the role to the appropriate OU or account.
• In the member account, assume the role to perform actions on resources in the management account or
other member accounts.

Result:
Thus, the Cloud Organization was created in AWS with Role-Based Access Control was implemented
successfully.
EX.NO:02 Create a Cost-model for a web application using various services and do Cost-benefit analysis
Date:

Aim:
To create a Cost-model for a web application using various services and make a analysis for Cost-benefit.

Procedure:
Creating a cost-model for a web application in AWS involves estimating the costs of using various AWS
services for the application. Here's a general process to create a cost-model and do cost-benefit analysis:

1. Identify the AWS services used by the web application: Some common services used by web
applications include Amazon S3, Amazon EC2, Amazon RDS, Amazon API Gateway, AWS
Lambda, Amazon DynamoDB, Amazon CloudFront, and Amazon SNS.

2. Estimate the costs of each service: You can use the AWS Pricing Calculator to estimate the costs
of each service. The pricing calculator allows you to enter the specifics of your usage, such as the
number of instances, storage size, and data transfer.
3. Create a cost-model: Once you have estimated the costs of each service, you can create a cost-
model that summarizes the total costs. You can use a spreadsheet or a cloud cost management tool to
create the cost-model.
4. Do cost-benefit analysis: After creating the cost-model, you can do a cost-benefit analysis to
determine if the benefits of using AWS services outweigh the costs. You can compare the costs of
using AWS services to the costs of running the application on-premises or using a different cloud
provider.
Program:
# Cost model for a simple web application
cloud_hosting = 100 # Monthly cost for cloud hosting (e.g., AWS)
database = 50 # Monthly cost for database service (e.g., AWS RDS)
third_party_services = 20 # Monthly cost for third-party services (e.g., Auth0)
development_cost = 5000 # One-time cost for development
maintenance_cost = 0.1 * development_cost # 10% of development cost per year

# Revenue generated from the application


monthly_revenue = 1000 # Monthly revenue from the web app

# Total monthly cost (hosting + database + services)


monthly_cost = cloud_hosting + database + third_party_services

# Annual costs (including development)


annual_cost = (monthly_cost * 12) + development_cost + maintenance_cost

# Annual revenue
annual_revenue = monthly_revenue * 12

# Cost-benefit analysis (ROI)


roi = (annual_revenue - annual_cost) / annual_cost * 100

# Output results
print(f"Annual Cost: ${annual_cost}")
print(f"Annual Revenue: ${annual_revenue}")
print(f"Return on Investment (ROI): {roi:.2f}%")
Output:

Annual Cost: $11600


Annual Revenue: $12000
Return on Investment (ROI): 3.45%

Result:
Thus, Cost-model for a web application using various services created and analysis was implemented
successfully.
EX.NO:03 Create alerts for usage of Cloud Resources
Date:

Aim:
To create alerts for usage of Cloud Resources.

Procedure:
To create alerts for usage of Cloud resources in AWS, you can use Amazon CloudWatch and AWS Lambda.
Here's an example code that creates an alert for Amazon S3 bucket usage:

1. Create an IAM role for the Lambda function with the following policy.
2. Create a new Lambda function with the following code.
3. Set the Lambda function trigger to run every day at a specific time.
4. Create a CloudWatch alarm with the following code.

Program:

import random
import time

# Simulated cloud resource usage (in percentage)


cpu_usage = random.randint(50, 100) # Simulating CPU usage (50% to 100%)
memory_usage = random.randint(50, 100) # Simulating Memory usage (50% to 100%)
storage_usage = random.randint(50, 100) # Simulating Storage usage (50% to 100%)

# Thresholds for resource usage


cpu_threshold = 80
memory_threshold = 80
storage_threshold = 80

# Function to check resource usage and send alerts


def check_usage(cpu, memory, storage):
if cpu > cpu_threshold:
print(f"ALERT: CPU usage is {cpu}% which exceeds the threshold of {cpu_threshold}%")
if memory > memory_threshold:
print(f"ALERT: Memory usage is {memory}% which exceeds the threshold of {memory_threshold}%")
if storage > storage_threshold:
print(f"ALERT: Storage usage is {storage}% which exceeds the threshold of {storage_threshold}%")

# Simulating continuous monitoring every few seconds


while True:
check_usage(cpu_usage, memory_usage, storage_usage)
# Randomly simulate changes in usage for the next iteration
cpu_usage = random.randint(50, 100)
memory_usage = random.randint(50, 100)
storage_usage = random.randint(50, 100)

# Wait for 5 seconds before checking again


time.sleep(5)

Output:

ALERT: CPU usage is 85% which exceeds the threshold of 80%


ALERT: Memory usage is 90% which exceeds the threshold of 80%
ALERT: Storage usage is 92% which exceeds the threshold of 80%

Result:
Thus, usage alerts for cloud resources were implemented successfully.
EX.NO:04 Create Billing alerts for your Cloud Organization
Date:

Aim:
To create billing alerts for your Cloud Organization.

Procedure:
To create billing alerts for your Cloud Organization in AWS, you can follow these steps:

1. Sign in to the AWS Management Console and navigate to the Billing and Cost Management service.
2. In the navigation pane, choose "Budgets".
3. Click on "Create budget" and select "Cost budget".
4. Provide a name and description for your budget.
5. Choose the time period for your budget (e.g., Monthly, Quarterly, Annually).
6. Configure the budget threshold. You can choose to set a fixed budget amount or a percentage of your
actual costs.
7. Configure the alerts. You can choose to receive alerts via email or Amazon SNS.

Program:

import random
import time

# Simulated cloud billing data (in USD)


monthly_bill = random.randint(50, 500) # Simulating the monthly bill (between $50 and $500)
billing_threshold = 300 # Billing threshold for alert

# Function to check billing and send alerts


def check_billing(bill):
if bill > billing_threshold:
print(f"ALERT: Your cloud bill has reached ${bill} which exceeds the threshold of
${billing_threshold}!")

# Simulating continuous monitoring of the billing


while True:
check_billing(monthly_bill)

# Simulate changes in the bill for the next iteration (e.g., usage spikes, added services)
monthly_bill = random.randint(50, 500)

# Wait for 10 seconds before checking again


time.sleep(10)
Output:

ALERT: Your cloud bill has reached $350 which exceeds the threshold of $300!
ALERT: Your cloud bill has reached $450 which exceeds the threshold of $300!

Result:
Thus, billing alerts for your Cloud Organization were implemented successfully.
EX.NO:05 Compare Cloud cost for a simple web application across AWS, Azure and GCP and suggest
the best one
Date:

Aim:
To compare Cloud cost for a simple web application across AWS, Azure and GCP and suggest the best one

Observation:
1. AWS: AWS offers a rich array of tools, including databases, analytics, management, IoT, security, and
enterprise applications. AWS introduced per-second billing in 2017 for EC2 Linux-based instances
and EBS volumes.

2. Azure: Azure has slightly surpassed AWS in the percentage of enterprises using it. Azure also offers
various services for enterprises, and Microsoft’s longstanding relationship with this segment makes it
an easy choice for some customers. While Azure is the most expensive choice for general-purpose
instances, it’s one of the most cost-effective alternatives to compute-optimized instances.

3. Google Cloud Platform (GCP): GCP stands out thanks to its almost limitless internal research
and expertise. GCP is different due to its role in developing various open-source technologies.
Google Cloud is much cheaper than AWS and Azure for computing optimized cloud-based
instances.

The best platform depends on your specific needs and requirements. If you need a wide array of tools and services,
AWS might be the best choice. If you’re looking for enterprise services and have a longstanding relationship
with Microsoft, Azure could be your best bet.

Conclusion:
If you prioritize innovation and open-source technologies, GCP could be the right choice. For compute-
optimized instances, GCP seems to be the most cost-effective. However, it’s essential to understand your
requirements fully before making a decision.

Result:
Thus, the comparison for Cloud cost for a simple web application across AWS, Azure and GCP were
implemented successfully.

You might also like