- Barajar
ActivarDesactivar
- Alphabetizar
ActivarDesactivar
- Frente Primero
ActivarDesactivar
- Ambos lados
ActivarDesactivar
- Leer
ActivarDesactivar
Leyendo...
Cómo estudiar sus tarjetas
Teclas de Derecha/Izquierda: Navegar entre tarjetas.tecla derechatecla izquierda
Teclas Arriba/Abajo: Colvea la carta entre frente y dorso.tecla abajotecla arriba
Tecla H: Muestra pista (3er lado).tecla h
Tecla N: Lea el texto en voz.tecla n
Boton play
Boton play
19 Cartas en este set
- Frente
- Atrás
Handler
|
A typical layout for a Lambda function might look something like this, where we divide the functionality into multiple layers. It starts with the handler function that we just talked about where you would set up your function configuration.
|
Controller
|
Instead, you would put that business logic into a controller class that's responsible for handling the actual event itself and doing all of the business-specific functionality for that particular method.
|
Service
|
Service classes can be used to abstract away any external services that your function needs to interface with and provide business interfaces into those external services.
|
Libraries and frameworks
|
When you start including external libraries and frameworks into your function, it's important to understand how that impacts the cold starts for your Lambda functions
|
What happens when a Lambda function runs?
|
there's a bootstrap component to that start up time for that function where the runtime itself needs to be bootstrapped, and all of the dependencies for that function have to be loaded from S3 and initialized.
|
What do I have to do to optimize the cold starts for my function?
|
you should consider reducing the overall size of your libraries.
So that means removing any unnecessary dependencies in your dependency graph, as well as being conscious of the overall start up time for the libraries you're using. |
Example of libraries that can impact the optimization?
|
Spring within the Java context take a long time to initialize, and that time is going to impact the cold start times for your function. Also, if you're using any compiled libraries within your function, consider statically linking them instead of using dynamic link libraries.
|
What can I use if I'm already developing applications using Jersey or Spring Boot.
|
You can use the AWS Serverless Java Container in order to migrate that code into a serverless context without having to make significant changes to your application.
|
What can I use if I'm already developing applications using Nodejs or Python?
|
Similarly, for Node.js and Python, if you're using frameworks like Express or Django, the AWS Serverless Express Framework and Zappa, respectively, can allow you to use those frameworks within a Lambda context as well.
|
Tools that we know and additions in serverless
|
|
Tradional application
|
In a traditional application, you would typically use a build tool like Maven or Gradle to create a compiled application binary that then goes and gets deployed onto a cluster of servers.
|
What are the traditional when you're deploying a serverless application?
|
This includes building the code, zipping it up, sending it to Amazon S3, managing all of the different execution roles, and IAM policies, creating the function API and other resources that are integrated to your application, and then finally updating those integrations and creating any other components that are necessary.
|
What tool is typically used when we think about a complex process like this (but it isn't the best implementation)?
|
We would use a tool like AWS CloudFormation to script out and declare all of the different resources that need to be created, and to help with the orchestration there.
|
What is one of the benefits of using an application framework such as the AWS Serverless Application Model (SAM)?
|
It's that the code required to define all of those application components is dramatically simplified.
|
What are we doing in this example SAM?
|
We're defining a function as well as the events sources and API structure, all in a few lines of code. So, compared to the previous CloudFormation template that would've taken potentially hundreds of lines to define our application, we can now do the same thing in much, much less code. It makes it more maintainable and easier to develop and scale overall as you build larger and larger applications.
|
What SAM tool provides an easy package and deployment of applications?
|
AWS SAM provides a CLI that allows you to easily package and deploy your applications. The first step in packaging a new application is to run the SAM package command. That command is going to take all of the function code or compiled binaries within your application, create a zip archive that's ready to be deployed to Lambda, and upload that to Amazon S3.
|
What can you do once you've created a package template using the SAM CLI?
|
It can then be deployed using the AWS CloudFormation service. So, this allows us to simplify the overall deployment process we looked at previously to two simple CLI commands.
And now we can manage our application deployment across multiple accounts and environments easily and repeatably in order to provide an automated deployment mechanism. |
What other frameworks can I use for serverless applications?
|
Now, we've talked specifically about the AWS Serverless Application Model, which is one example of these application frameworks. However, you should be aware that there are a number of other framework options out there in the community.
|
What are the recommendations for managing serverless applications? Select all that apply.
|
You should use a serverless application framework to simplify the deployment process. The AWS serverless framework, SAM uses SAM templates which are streamlined versions of an Amazon CloudFormation template.
|