CST-440 - Web Framework in Cloud (AngularJS) - UNIT1
CST-440 - Web Framework in Cloud (AngularJS) - UNIT1
ENGINEERING (UIE)
CO1: The students will become familiar with the concepts cloud web development, REST
API’s, use of REST API’s in AngularJS
Cloud Computing is one of the latest trends in application deployment and web integration, which
not only reduces costs but also gives many functionalities. The main purpose of cloud computing
is to give access to data centers to many users. Users can also access data from a remote server.
ex: AWS, Azure, Google Cloud.
What is Cloud?!!!
Cloud is nothing but a server that we access over the internet, it contains a large amount of data
such as text files, video, audio, images, docs, pdfs, and so on.
Advances in virtualization make it possible to see the growth of Internet clouds as a new
computing paradigm.
It is just like developing software for millions to use as a service rather than distributing
software to run on their PCs.
Evolution Of Cloud:
In 1984, John Gage Sun Microsystems gave the slogan, “The network is the computer.”
In 2008, David Patterson UC Berkeley said, “The data center is the computer.”
Rajkumar Buyya of Melbourne University simply said: “The cloud is the computer.”
Some people view clouds as grids or clusters with changes through virtualization since clouds
are anticipated to process huge data sets generated by the traditional Internet, social networks,
and the future IoT.
A distributed system consists of multiple autonomous computers, having their own memory,
communicating through message passing.
Clouds can be built with physical or virtualized resources over large data centers that are
distributed systems. Cloud computing is also considered to be a form of utility computing or
service computing.
Amazon S3 (Simple Storage Service): store arbitrary datasets, pay per GB-month stored.
Amazon EC2 (Elastic Compute Cloud): upload and run arbitrary OS images, pay per CPU
hour used.
Google App Engine/Compute Engine: develop applications within their App Engine framework,
upload data that will be imported into their format, and run.
Aim towards automatic operations that can be self-organized to support dynamic discovery.
Major computing paradigms are composable with QoS and SLAs.
Plug your thin client into the computing Utility and play intensive compute and Communicate
Applications.
Utility computing focuses on a business model in which customers receive computing resources
from a paid service provider.
Data-intensive Nature: What was MBs has now become TBs, PBs, and XBs.
Demand services
On-demand: renting vs. buying one. E.g.: AWS Elastic Compute Cloud (EC2): a few cents to a
few $ per CPU hour AWS Simple Storage Service (S3): a few cents per GB-month.
Haas: Hardware as a Service: Get access to barebones hardware machines, do whatever you
want with them, Ex: Your own cluster Not always a good idea because of security risks.
PaaS: Platform as a Service: Get access to flexible computing and storage infrastructure,
coupled with a software platform (often tightly coupled) Ex: Google’s App Engine (Python, Java,
Go).
SaaS: Software as a Service: Get access to software services, when you need them. subsume
SOA (Service Oriented Architectures). Ex: Google docs, MS Office on demand.
Data-intensive Computing
Data-Intensive: Typically store data at datacenters Use compute nodes nearby Compute nodes
run computation services.
CPU utilization no longer the most important resource metric, instead I/O is disk and/or
network.
Yahoo! (Hadoop + Pig): WebMap: a chain of several MapReduce jobs, 300 TB of data, 10K
cores, many tens of hours (~2008)
Facebook (Hadoop + Hive): ~300TB total, adding 2TB/day (in 2008) , 3K jobs processing
55TB/day
Cloud Computing is one of the latest trends in application deployment and web integration,
which not only reduces costs but also gives many functionalities. The main purpose of cloud
computing is to give access to data centers to many users. Users can also access data from a
remote server. ex: AWS, Azure, Google Cloud.
The term "cloud services" refers to a wide range of services delivered on demand to companies
and customers over the internet. These services are designed to provide easy, affordable access
to applications and resources, without the need for internal infrastructure or hardware. From
checking email to collaborating on documents, most employees use cloud services throughout
the workday, whether they’re aware of it or not.
Cloud services are fully managed by cloud computing vendors and service providers. They’re
made available to customers from the providers' servers, so there's no need for a company to
host applications on its own on-premises servers.
The most widely recognized type of cloud service is known as software as a service, or SaaS.
This broad category encompasses a variety of services, such as file storage and backup, web-
based email, and project management tools.
Examples of SaaS cloud service providers include Dropbox, G Suite, Microsoft Office 365,
Slack and Citrix Content Collaboration. In each of these applications, users can access, share,
store, and secure information in “the cloud.”
Examples of IaaS are Amazon Web Services (AWS), Microsoft Azure and Google Compute
Engine. These providers maintain all storage servers and networking hardware, and may also
offer load balancing, application firewalls, and more. Many well-known SaaS providers run on
IaaS platforms.
The cloud service model known as platform as a service, or PaaS, serves as a web-based
environment where developers can build cloud apps. PaaS provides a database, operating
system and programming language that organizations can use to develop cloud-based software,
without having to maintain the underlying elements.
Many IaaS vendors, including the examples listed above, also offer PaaS capabilities.
When describing a cloud computing framework, the umbrella term “framework” refers to
anything from sets of development tools, middleware technology, or even database management
software that helps with the administration, creation, and control of cloud applications.
A cloud adoption framework is a strategy to help companies expedite their cloud migration or
adoption process. For example, Microsoft’s Cloud Adoption Framework for Azure includes a
set of documents, guidelines, best practices, and implementation instructions that make it easy
for companies to plan out their move to the cloud.
It is extremely important to use a secure operating system when inputting your data on the
cloud. What measures do cloud computing services put in place to prevent dangerous internet
crime from reaching your cloud?
Encrypting data
A must for organizations using multilayer cloud integration and highly important for businesses
of all sizes, cloud data encryption ensures all data stored on the cloud is safely kept both when
in use and at rest.
Many cloud services adopt a shared-responsibility model, where compliance and accountability
for utmost security are divided between the cloud provider and the customer – the first takes care
of the security of the cloud infrastructure, the latter for keeping data within the cloud. Within
this security model, it is key to define data ownership between public and private third parties,
so the customer can navigate it seamlessly.
Besides the pay-per-use model, cloud service providers also give companies a wide range of
benefits. Businesses can take advantage of scalability and flexibility by not being limited to
physical constraints of on-premises servers, the reliability of multiple data centers with multiple
redundancies, customization by configuring servers to your preferences and responsive load
balancing which can easily respond to changing demands. Though businesses should also
evaluate security considerations of storing information in the cloud to ensure industry-
recommended access and compliance management configurations and practices are enacted and
met.
Once you have decided to make the move to cloud computing, your next step is to select a cloud
service provider. It is vital to assess the reliability and capability of a service provider that you
plan to entrust with your organisation’s applications and data. Some things to consider:
Financial health. The provider should have a track record of stability and be in a healthy financial
position with sufficient capital to operate successfully over the long term.
Organisation, governance, planning and risk management. The provider should have a formal
management structure, established risk management policies and a formal process for assessing
third-party service providers and vendors.
Trust. You should like the company and its principles. Check the provider’s reputation and see
who its partners are. Find out its level of cloud experience. Read reviews and talk to customers
whose situation is similar to yours.
Business knowledge and technical know-how. The provider should understand your business
and what you are looking to do and be able to match it up with their technical expertise.
Compliance audit. The provider should be able to validate compliance with all of your
requirements through a third-party audit.
Administration support
Service Level Agreements (SLAs). Providers should be able to promise you a basic level of
service that you are comfortable with.
Performance reporting. The provider should be able to give you performance reports.
Resource monitoring and configuration management. There should be sufficient controls for the
provider to track and monitor services provided to customers and any changes made to their
systems.
Billing and accounting. This should be automated so that you can monitor what resources you
are using and the cost, so you don’t run up unexpected bills. There should also be support for
billing-related issues.
Ease of deployment, management and upgrade. Make sure the provider has mechanisms that
make it easy for you to deploy, manage and upgrade your software and applications.
Standard interfaces. The provider should use standard APIs and data transforms so that your
organisation can easily build connections to the cloud.
Event management. The provider should have a formal system for event management which is
integrated with its monitoring/management system.
Change management. The provider should have documented and formal processes for
requesting, logging, approving, testing and accepting changes.
Hybrid capability. Even if you don’t plan to use a hybrid cloud initially, you should make sure
the provider can support this model. It has advantages that you may wish to exploit at a later
time.
Security practices
Security infrastructure. There should be a comprehensive security infrastructure for all levels
and types of cloud services.
Security policies. There should be comprehensive security policies and procedures in place for
controlling access to provider and customer systems.
Identity management. Changes to any application service or hardware component should be
authorised on a personal or group role basis and authentication should be required for anyone to
change an application or data.
Data backup and retention. Policies and procedures to ensure integrity of customer data should
be in place and operational.
Physical security. Controls ensuring physical security should be in place, including for access to
co-located hardware. Also, data centers should have environmental safeguards to protect
equipment and data from disruptive events. There should be redundant networking and power
and a documented disaster recovery and business continuity plan.
CO1: The students will become familiar with the concepts cloud web development, REST
API’s, use of REST API’s in AngularJS
REST stands for REpresentational State Transfer. REST is web standards based architecture and
uses HTTP Protocol. It revolves around resource where every component is a resource and a
resource is accessed by a common interface using HTTP standard methods. REST was first
introduced by Roy Fielding in 2000.
In REST architecture, a REST Server simply provides access to resources and REST client
accesses and modifies the resources. Here each resource is identified by URIs/ global IDs. REST
uses various representation to represent a resource like text, JSON, XML. JSON is the most
popular one.
HTTP methods
Following four HTTP methods are commonly used in REST based architecture.
Web services based on REST Architecture are known as RESTful web services. These
webservices uses HTTP methods to implement the concept of REST architecture. A RESTful
web service usually defines a URI, Uniform Resource Identifier a service, provides resource
representation such as JSON and set of HTTP Methods.
You can use Java™ API for RESTful Web Services (JAX-RS) to develop services that follow
Representational State Transfer (REST) principles. RESTful services are based on manipulating
resources. Resources can contain static or dynamically updated data. By identifying the
resources in your application, you can make the service more useful and easier to develop.
After you have identified the application that you want to expose as a RESTful service, you must
first define the resources for your RESTful application. After you have defined the resources for
your application, consider the type of data you want to expose. Perhaps you already have a
relational database that contains information that you want to expose to users that are using the
REST technology. Do you already have a set of Java classes defined for accessing that data?
For example, consider the case of an application that is defined to support a book store. This
application currently has a database with several tables that define the various items in the
collection of books and the inventory of each book. In this example, there are a number of ways
to represent the data in the database in a RESTful application. One approach is to consider each
table as an individual resource, so that each of the verbs in the RESTful request maps to the
actions that the database supports on that table such as select, insert, update, delete. This example
is a simple approach to creating a RESTful application. This approach using the book store
example is also used in the documentation that describes defining URL patterns for resources,
resource methods, HTTP headers and response codes, media types, and parameters for request
representations to resources
In support of this database for the book store application, there might already be existing code
that is responsible for accessing the database and retrieving the data from each table. Even
though the rows in each of the tables logically represent each resource, the accessor classes are
used to define the resources. The implementing JAX-RS applications documentation provides
more details on how these classes are incorporated into your JAX-RS application.
Alternately, you might have more static content that does not reside in a database that you want
to distribute as resources. Whether it is a collection of documents in various formats or a
resource-based facade for other remote systems, when using JAX-RS, you can distribute content
from multiple sources.
Resources are the basic building block of a RESTful service. Examples of a resource from an
online book store application include a book, an order from a store, and a collection of users.
Resources are addressable by URLs and HTTP methods can perform operations on resources.
Resources can have multiple representations that use different formats such as XML and JSON.
You can use HTTP headers and parameters to pass extra information that is relevant to the
request and response.
With JAX-RS, you can annotate existing or new Plain Old Java objects (POJO) with JAX-RS
specific annotations. JAX-RS annotated resource classes and the annotated methods are started
depending on the URI patterns.
Procedure
Results
You have defined the content that you want to expose as a collection of resources in your
application.
What to do next
Based on the resources that you have defined, read about defining URL patterns for resources,
resource methods, HTTP headers and response codes, media types, and parameters for request
representations to resources to learn more about additional steps you can take to define the
resources for your JAX-RS application.
Learning REST in pieces is one thing while applying all these concepts into real application
development is completely another challenge.
In this tutorial, we will learn to design REST APIs for a network-based application. Please note
that the takeaway from this whole exercise is the learning of how to apply REST principles in the
application design process.
The very first step in designing a REST API-based application is – identifying the objects which
will be presented as resources.
For a network-based application, object modeling is pretty much more straightforward. There
can be many things such as devices, managed entities, routers, modems, etc. For simplicity sake,
we will consider only two resources i.e.
➢ Devices
➢ Configurations
Here configuration may be a sub-resource of a device. A device can have many configuration
options.
Note that both objects/resources in our above model will have a unique identifier, which is the
integer id property.
Now when the object model is ready, it’s time to decide the resource URIs. At this step, while
designing the resource URIs – focus on the relationship between resources and their sub-
resources. These resource URIs are endpoints for APIs.
/devices
/devices/{id}
/configurations
/configurations/{id}
/devices/{id}/configurations
/devices/{id}/configurations/{id}
Notice that these URIs do not use any verb or operation. It’s crucial not to include any verb in
URIs. URIs should all be nouns only.
Now when resource URIs have been decided, let’s work on their representations. Most
representations are defined in either XML or JSON format.
So our resource URIs and their representation are fixed now. Let’s decide all the possible
operations in the application and map those operations to the resource URIs.
For example, a user of our network application can perform browse, create, update, or delete
devices from the network as well as create/deploy/remove the device configurations.
5. More Actions
So far, we have designed only object models, URIs and then decided HTTP methods or
operations on them. You need to work on other aspects of the application as well:
1) Logging
2) Security
3) Discovery etc.
See the source code of this example application to understand better. So our resource URIs and
their representation are fixed now. Let’s decide all the possible operations in the application and
map those operations to the resource URIs.
References