Aws Flashcards
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
- db event: send an email when an palce new order added to db
- io event: trigger a lambda to send a push notification on users device
Limitations of serverless computing
- Can be more difficult to debug than traditional backend code
- May not be suitable for long-running tasks
- could be more expensive
Types of serverless functions (Firebase)
- Restful functions: triggered by HTTP requests
- Reactive functions: triggered by events in the cloud (e.g., database updates, file uploads)
What are the benefits of using CDK over manually creating AWS resources in the console?
Cloud Development Kit
infrastructure as code
- Automatic completion and error checking in an IDE
- Version control with tools like Git
- Reusability of code through constructs and stacks
- Integration with CI/CD pipelines for automated deployments
What are the different types of constructs available in CDK?
CDK offers 3 constructs.
- cfn resource, low level: L1 constructs map directly to individual AWS resources,
- L2:has default values
- high-level: L3 constructs provide a more abstract layer for common infrastructure patterns.
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?
- it may have a steeper learning curve compared to manually provisioning
- CDK might not support all the latest AWS features immediately.
Cloud formation vs CDK?
- Feature: CloudFormation / CDK
- Approach: Template-based /Code-based (programming languages)
- Reusability: Limited / Improved through constructs and stacks
- Type safety: No /Yes (with languages like TypeScript)
- Learning curve: Lower /Steeper, requires programming knowledge
- Integration: Manual or AWS Management Console / Integrates with CI/CD pipelines
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