SAM Flashcards

1
Q

Serverless Application Model (SAM)

A

An open-source framework for building serverless applications.

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

What does SAM provide?

A

It provides shorthand syntax to express functions, APIs, databases, and event source mappings.

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

Template configuration options for SAM?

A

You create a JSON or YAML configuration template to model your applications.

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

How is SAM transformed and expanded upon deployment?

A

During deployment, SAM transforms and expands the SAM syntax into AWS CloudFormation syntax. Any resource that you can declare in an AWS CloudFormation template you can also declare in an AWS SAM template.

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

SAM CLI

A

The SAM CLI provides a Lambda-like execution environment that lets you locally build, test, and debug applications defined by SAM templates. You can also use the SAM CLI to deploy your applications to AWS.

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

True/False. You can use AWS SAM to build serverless applications that use any runtime supported by AWS Lambda.

A

True.

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

True/False. You can also use SAM CLI to locally debug Lambda functions written in Node.js, Java, Python, and Go.

A

True.

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

True/False. The Transform section is not required if you are writing a SAM template along and not via CloudFormation.

A

False. If you are writing an AWS Serverless Application Model template alone and not via CloudFormation, the Transform section IS required.

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

Globals section.

A

The Globals section is unique to AWS SAM templates. It defines properties that are common to all your serverless functions and APIs. All the AWS::Serverless::Function, AWS::Serverless::Api, and AWS::Serverless::SimpleTable resources inherit the properties that are defined in the Globals section.

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

Resources section.

A

The Resources section can contain a combination of AWS CloudFormation resources and AWS SAM resources.

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

Syntax: AWS::Serverless::Api

A

This resource type describes an API Gateway resource. It’s useful for advanced use cases where you want full control and flexibility when you configure your APIs.

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

Syntax: AWS::Serverless::Application

A

This resource type embeds a serverless application from the AWS Serverless Application Repository or from an Amazon S3 bucket as a nested application. Nested applications are deployed as nested stacks, which can contain multiple other resources.

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

Syntax: AWS::Serverless::Function

A

This resource type describes configuration information for creating a Lambda function. You can describe any event source that you want to attach to the Lambda function—such as Amazon S3, Amazon DynamoDB Streams, and Amazon Kinesis Data Streams.

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

Syntax: AWS::Serverless::LayerVersion

A

This resource type creates a Lambda layer version that contains library or runtime code needed by a Lambda function. When a serverless layer version is transformed, AWS SAM also transforms the logical ID of the resource so that old layer versions are not automatically deleted by AWS CloudFormation when the resource is updated.

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

Syntax: AWS::Serverless::SimpleTable

A

This resource type provides simple syntax for describing how to create DynamoDB tables.

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

What SAM commands generates pre-configured AWS templates?

A

The sam init command generates pre-configured AWS SAM templates.

17
Q

What SAM command supports local invocation and testing of Lambda and serverless applications by executing your function code locally in a Lambda-like execution environment?

A

The sam local command supports local invocation and testing of your Lambda functions and SAM-based serverless applications by executing your function code locally in a Lambda-like execution environment.

18
Q

What SAM commands package and deploy your code?

A

The sam package and sam deploy commands let you bundle your application code and dependencies into a “deployment package” and then deploy your serverless application to the AWS Cloud.

19
Q

What command enables you to fetch, tail, and filter logs for Lambda functions?

A

The sam logs command enables you to fetch, tail, and filter logs for Lambda functions.

20
Q

What does the output of a SAM publish command include?

A

The output of the sam publish command includes a link to the AWS Serverless Application Repository directly to your application.

21
Q

How do you validate your SAM template?

A

Use sam validate to validate your SAM template.

22
Q

How can you control access to APIs?

A

You can use AWS SAM to control who can access your API Gateway APIs by enabling authorization within your AWS SAM template.

23
Q

Lambda Authorizer

A

(formerly known as a custom authorizer) is a Lambda function that you provide to control access to your API. When your API is called, this Lambda function is invoked with a request context or an authorization token that is provided by the client application. The Lambda function returns a policy document that specifies the operations that the caller is authorized to perform, if any.

24
Q

Types of Lambda Authorizers

A

-Token based type receives the caller’s identity in a bearer token, such as a JSON Web Token (JWT) or an OAuth token.
-Request parameter based type receives the caller’s identity in a combination of headers, query string parameters, stageVariables, and $context variables.

25
Q

Amazon Cognito User Pools?

A

User directories in Amazon Cognito. A client of your API must first sign a user in to the user pool and obtain an identity or access token for the user. Then your API is called with one of the returned tokens. The API call succeeds only if the required token is valid.

26
Q

Transform section of a CloudFormation template?

A

The optional Transform section of a CloudFormation template specifies one or more macros that AWS CloudFormation uses to process your template.

27
Q

Aside from your macros, what does CloudFormation support for a macros hosted on AWS CloudFormation?

A

Aside from macros you create, AWS CloudFormation also supports the AWS::Serverless transform which is a macro hosted on AWS CloudFormation.

28
Q

What does AWS::Serverless transform specify?

A

The AWS::Serverless transform specifies the version of the AWS Serverless Application Model (AWS SAM) to use. This model defines the AWS SAM syntax that you can use and how AWS CloudFormation processes it.