What are the benefits of using serverless over traditional servers
provisioning environment automatically.
easier to deploy and scale as they only require uploading code.
secure by default as the environment is not accessible and cannot be modified externally.
How can you reduce the bundle size of a Lambda function that includes Prisma?
By removing unnecessary engines from the node_modules folder, such as the migration engine, which are not required for Lambda execution
What is the purpose of cdk synth command?
The cdk synth command creates a CloudFormation template and a function from the CDK code.
This template defines the infrastructure resources for your application.
Explain how API Gateway integrates with a Lambda function.
An API Gateway creates a REST API endpoint that triggers the Lambda function when a request is received.
The Lambda function handler processes the request and returns a response.
What are the advantages of using Lambda layers?
share dependencies across multiple Lambda functions.
This reduces deployment time and cost, especially when deploying multiple functions that rely on the same libraries like Prisma
Give 2 examples of AWS Lambda
Limitations of serverless computing
Types of serverless functions (Firebase)
What are the benefits of using CDK over manually creating AWS resources in the console?
Cloud Development Kit
infrastructure as code
What are the different types of constructs available in CDK?
CDK offers 3 constructs.
CDK Migrate ?
can help import your resources from your AWS account into a CDK project. This can be a useful starting point for managing your infrastructure as code.
What are some of the limitations or challenges of using CDK?
Cloud formation vs CDK?
CDK will be complied to Cloud formation format at the end
Choosing between CloudFormation and CDK?
Use CloudFormation if:
* You need a simple solution for basic deployments.
* You prefer a visual editor like the AWS Management Console.
* You have limited programming experience.
Use CDK if:
* You need to manage complex infrastructure.
* You value code reusability and maintainability.
* You want type safety and error checking during development.
* You want easier integration with CI/CD pipelines.
Amazon SNS & usecase
Amazon SNS (Simple Notification Service): Follows a publish-subscribe (pub/sub) model, where messages are published to topics and delivered to multiple subscribers who have subscribed to the topic.
usecase:
- Ideal for scenarios requiring message broadcast to multiple subscribers, like a realtime notification
- can be used by Event Router
Amazon SQS & usecase
Amazon SQS (Simple Queue Service): Utilizes a message queueing model, where messages are sent to a queue and processed by consumers. Each message is typically processed by only one consumer, and messages are removed from the queue after processing.
usecase:
Suited for distributing workloads across multiple consumers or services
resouce policy vs execution role in AWS
A resource policy
- determines who is allowed in (who can initiate your function, such as Amazon S3),
- it can be used to grant access across accounts.
An execution role
- must be created or selected when creating your function
- it controls what Lambda is allowed to do (such as writing to a DynamoDB table).
- It includes a trust policy with AssumeRole.
4 AWS lambda design best practices?
Separate business logic
+
Write modular functions
+
Treat functions as stateless
+
Only include what you need