SAM (new) Flashcards

1
Q

What is a Serverless Application Model (SAM)?

A

SAM is built on and extends Cloud Formation.

SAM uses abstract, short-hand syntax to define and provision the infrastructure (Lambda functions, API Gateway and DynamoDB etc) for serverless apps.

It transforms the template to code behind the scenes to provision your infrastructure through Cloud Formation

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

Name the 5 benefits of SAM?

A

DMD QC

D - Define infrastructure quickly using less code
M - Manage the development lifecycle of serverless apps
D - Debug and test Lambda functions and layers locally
Q - Quickly give permissions between resources using SAM Connectors
C - Continuously sync local changes to the cloud as you develop

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

How would SAM improve the process of creating a serverless app such as a microservice with Lambda functions and an API Gateway Endpoint?

A
  1. Define Infrastructure quickly, less code
  2. Manage the development life cycle of the app - ‘Sam deploy’ used for quick deployment
  3. Debug and test locally
  4. Quickly give permissions through IAM roles
  5. API Gateway config (can define API methods etc in template)
  6. Resource Abstraction (abstracts complexities making it easier to define DynamoDB tables etc)
  7. Parameterization and Reusability
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Name the 2 SAM components

A

SAM Template (define and manage resources)
SAM CLI (build and run)

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

What are the 8 key parts of a SAM template?

A

SAM template (YAML): (ATOM DRP G)
A - AWSTemplateFormatVersion
T - Transform
O - Outputs
M - Metadata

D - Description
R - Resources
P - Parameters

G - Globals

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

What does ‘Principal’ attribute define on a template?

A

The person to get permission

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

What is AWSTemplateFormatVersion?

A

Cloud Formation version

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

What is Transform?

A

The SAM version

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

What are the outputs?

A

Outputs are values that can be exported by the CloudFormation stack.

They are useful if you need to share info between stacks

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

What is the metadata?

A

Metadata is optional info you can add

Ie., MyDescription: This is a sample SAM template

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

What are the resources?

A

Resources define the resources that make up your serverless app

To define a resource you name the:
1. Type ie., (AWS::Serverless::Function for a Lambda function)
2. Properties (codeUri, functionName, permissions)

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

What are the parameters?

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

What is resource type: AWS::Serverless::Function for?

A

Lambda functions?

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

What is resource type: AWS::Serverless::Api for?

A

It represents an API Gateway

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

What is resource type: AWS::Serverless::SimpleTable for?

A

A DynamoDB table

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

What is resource type: AWS::Serverless::Application for?

A

An app with multiple SAM resources

17
Q

What is resource type: AWS::Serverless::LayerVersion for?

A

Represents a Lambda layer

18
Q

What is resource type: AWS::Serverless::StateMachine for?

A

Represents Step Function state machine

19
Q

What is resource type: AWS::Serverless::HttpApi for?

A

HTTP API in API Gateway

20
Q

What is resource type: AWS::Serverless::WebSocketApi?

A

Represents a WebSocketApi in API gateway

21
Q

What is resource type: AWS::Serverless::ApiFunction for?

A

A combination of an API Gateway API and an AWS Lambda function.

22
Q

What is resource type: AWS::Serverless::Auth for?

A

Represents an authentication resource for your APIs.

23
Q

What is resource type: AWS::Serverless::NestedStack for?

A

Allows you to use an existing AWS CloudFormation template as a resource within your SAM template

24
Q

What is resource type: AWS::Serverless::ImageFunction for?

A

Represents a Lambda function for image processing

25
Q

How do you manage permissions in a SAM template?

A
  1. Define an IAM role for your Lambda function within the Properties section of the function resource. You can specify the role’s policies and permissions.

or

  1. Define a role for API gateway