Aws Flashcards

1
Q

What are the benefits of using serverless over traditional servers

A

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 well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How can you reduce the bundle size of a Lambda function that includes Prisma?

A

By removing unnecessary engines from the node_modules folder, such as the migration engine, which are not required for Lambda execution

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the purpose of cdk synth command?

A

The cdk synth command creates a CloudFormation template and a function from the CDK code.

This template defines the infrastructure resources for your application.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Explain how API Gateway integrates with a Lambda function.

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What are the advantages of using Lambda layers?

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Give 2 examples of AWS Lambda

A
  1. db event: send an email when an palce new order added to db
  2. io event: trigger a lambda to send a push notification on users device
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Limitations of serverless computing

A
  • Can be more difficult to debug than traditional backend code
  • May not be suitable for long-running tasks
  • could be more expensive
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Types of serverless functions (Firebase)

A
  • Restful functions: triggered by HTTP requests
  • Reactive functions: triggered by events in the cloud (e.g., database updates, file uploads)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What are the benefits of using CDK over manually creating AWS resources in the console?

A

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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What are the different types of constructs available in CDK?

A

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.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

CDK Migrate ?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What are some of the limitations or challenges of using CDK?

A
  • it may have a steeper learning curve compared to manually provisioning
  • CDK might not support all the latest AWS features immediately.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Cloud formation vs CDK?

A
  • 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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Choosing between CloudFormation and CDK?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Amazon SNS & usecase

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Amazon SQS & usecase

A

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

17
Q

resouce policy vs execution role in AWS

A

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.

18
Q

4 AWS lambda design best practices?

A

Separate business logic
+

Write modular functions
+

Treat functions as stateless
+

Only include what you need