This virtual hands-on workshop will start with a review of what is Serverless and Serverless Lambda. We will address the benefits of serverless and lambda and also some challenges associated with the technology. We will modernize the DT Orders application and deploy a new version of the catalog service. This will be followed by series of hands-on labs where you will:
Raise your hand if you are CLOUD NATIVE
... Oh thats you!!
We have come a long way through this migration and modernization journey we started back in Lab-0. We simulated a migration from on prem to EC2 Compute, we then modernized our application from monolith to a microservices architecture while shifting to a containerized approach and rehosting the application on an EKS cluster. However the journey is not yet complete, AWS continues to deliver technology that gives us addtional solutions for our digital products. That said, there is more we can do to improve our code base as well as our infrastructure. In the follwing lab we will be diving into the world of AWS Serverless specifically Lambda and what makes it a technology growing in popularity.
AWS Serverless is a cloud computing model provided by Amazon Web Services (AWS) where AWS manages the infrastructure, allowing adopters of the technology to build and run applications withoutn having to manage servers
.
Here are some key features and components of AWS Serverless:
Some disadvantages that must be mentioend
Not the case for Dynatrace
AWS Lambda functions are a good example of how a serverless framework works:
AWS Lambda is a serverless compute service that runs your code in response to events and automatically manages the underlying compute resources for you. These events may include changes in state or an update, such as a user placing an item in a shopping cart on an ecommerce website. You can use AWS Lambda to extend other AWS services with custom logic, or create your own backend services that operate at AWS scale, performance, and security. AWS Lambda automatically runs code in response to multiple events, such as HTTP requests via Amazon API Gateway, modifications to objects in Amazon Simple Storage Service (Amazon S3) buckets, table updates in Amazon DynamoDB, and state transitions in AWS Step Functions.
It also runs your code on high availability compute infrastructure and performs all the administration of your compute resources. This includes server and operating system maintenance, capacity provisioning and automatic scaling, code and security patch deployment, and code monitoring and logging. All you need to do is supply the code.
Lambda architecture is a data deployment model for processing that consists of a traditional batch data pipeline and a fast streaming data pipeline for handling real-time data. In addition to the batch layer and speed layers, Lambda architecture also includes a data serving layer for responding to user queries.
Below is conceptually were we are headed with our architechture. Modernizing the catalog service from its current state to a Lambda based architecture that includes an external RDS database running a MySql instance.
Lets do this!!
If you remember in the begining we asked you to clone the git repo to your AWS console, well inside of that repo we also uploaded all of the assets we will need to successfully deploy the your RDS database and Lambda Functions:
first lets take a look at what we have:
cd ~/aws-modernization-dt-orders-setup/provision-scripts/
and type
ls -ltr
This will display the contents of this directory you just switched to:
ensure that you have all of the files highlighted by red outlines as they do the following:
If you do not please advise your instructor or double check to make sure you are in the right directory.
look closely at your list of permissions specifically on the LambdaProvisionScript.sh it is not set up to be executatable. lets give it the permissions necessary to use that file. In your console cli type "chmod u+x LambdaProvisionScript.sh" now so that we can reference and execute the script. If you do another ls -ltr you will see it has now turned green.
./LambdaProvisionScript.sh
A shell script is one way to automate and execute commands in the AWS cli that will create the functions but of course there is other ways such as Cloud Formation Templates
, Terraform
or a myriad of other automation sdks.
This shell script for us doing the following:
What is a dynatrace layer? It a way to load all the libraries and dependancys necessary for lambda to talk to your DT-Tenant and provide you with the observability you need in context.
Once the script completes its time to double check a few things and finally deploy the changes to the catalog service in the workshop K8s cluster.
Here's how the Dynatrace Lambda Layer works and its benefits:
Easy Integration: By adding the Dynatrace Lambda Layer to your AWS Lambda functions, you can automatically monitor their performance without modifying the function's code. This layer includes the Dynatrace OneAgent, which is responsible for collecting metrics, traces, and logs.
Real-Time Visibility: Dynatrace provides real-time insights into the performance of your Lambda functions, including execution times, memory usage, and invocation counts. It helps identify performance bottlenecks, errors, and anomalies within your serverless applications.
Distributed Tracing: The Dynatrace Lambda Layer supports distributed tracing, allowing you to trace requests as they move through your serverless components and other parts of your architecture. This is crucial for understanding dependencies and interactions in microservices and serverless architectures.
Automated Anomaly Detection: Leveraging artificial intelligence and machine learning, Dynatrace can automatically detect anomalies and potential issues in your serverless applications. This proactive monitoring can help you address problems before they impact your users.
Optimization Opportunities: By analyzing the detailed performance data collected, Dynatrace can offer insights into optimization opportunities, helping you improve efficiency and reduce costs associated with running Lambda functions.
Seamless Integration with AWS Services: The Dynatrace Lambda Layer integrates well with various AWS services and resources involved in your serverless applications, providing a comprehensive monitoring solution.
In your Dynatrace tenant fron the right side menu as we did before select AWS
and open the CloudWatch dashboard
Click on the Lambda functions
box and you will notice that Dynatrace already knows about your recent deployment and is collecting on CloudWatch available metrics. At this point the Lambdas have not yet been deployed to the catalog service so not much going on.
Ensure you are still in the same directory
~/aws-modernization-dt-orders-setup/app-scripts/
Lets double check that the catalog-service-serverless.yml
has all the necessary updates from the LambdaProvisionScript.sh
cat catalog-service-serverless.yml
Your file should also have 2 sets of URLs as in the section pictured.
If you do not let your instructor know.
From this cat output you can see that the deployment will be targeting the catalog service in the staging
namespace, which is were our DT Orders app is currently running within our K8 cluster.
in your AWS CLI console type the following command: (make sure you are in the /provision-scripts directory)
kubectl apply -f catalog-service-serverless.yml
Validate that you have an output as pictured above. If you do SUCCESS however it will take a few minutes to get the changes to take place and traffic from the load gen to start flowing into the functions.
👍If we have time lets take a 5 min break and if we dont we will carry on
While modernizing to or in the cloud, you want to evaluate if your modernization goes according to the plan, whether the services are still performing well or even better than before, and whether your new architecture is as efficient as the blueprint suggested. Dynatrace helps you validate all these steps automatically, which helps speed up the modernization and validation process.
Having the ability to understand service flows enables us to make smarter re-architecture and re-platforming decisions. With support for new technologies like Kubernetes, Lambda and many other AWS technologies you have confidence to modernize with a platform that can cover the old and the new.
Dynatrace sees a lot of demand for Lambda serverless compute service and a slew of new capabilities and here is where to look for step by step reference Dynatrace documentation
In this section, you should have completed the following:
✅ Createded 2 Lambda functions and an RDS database
✅ Deployeded a change to the catalog service in the staging namespace with in K8 cluster
✅ Now we are ready to examine the modernized application using service flows through Lambda and backtraces