Practice Test

True or False: An AWS Lambda version is a snapshot of your function code and configuration that is immutable.

Answer: True

Explanation: Once a version is published, its code and most of its configuration details cannot be changed.

In AWS Lambda, what are aliases used for?

  • a) To create multiple versions of your Lambda function.
  • b) To test your Lambda function.
  • c) To route traffic between two versions of your Lambda function.
  • d) None of the above.

Answer: c) To route traffic between two versions of your Lambda function.

Explanation: Aliases are used to route traffic between two versions of your Lambda function. You can associate each alias with a specific version of a Lambda function and then use the alias to call that version.

True or False: AWS Lambda function versions and aliases simplify the process of code deployment and promote code reuse.

Answer: True

Explanation: Versions are immutable snapshots of function code and configuration, which promotes code reuse. Aliases simplify code deployments by enabling you to update functions and test them in a controlled environment.

True or False: AWS Lambda does not allow you to create pre-production dev and staging environments by mapping an alias to a function version.

Answer: False

Explanation: With AWS Lambda, you can create pre-production dev and staging environments by mapping an alias to a function version.

What is the special $LATEST version in AWS Lambda?

  • a) It always contains the oldest function code.
  • b) It always contains the most recently uploaded function code.
  • c) It is a special version used only for testing.
  • d) It is a special version that contains all the function codes.

Answer: b) It always contains the most recently uploaded function code.

Explanation: The $LATEST version is significantly different from other versions. When you upload a new function code, it becomes the $LATEST version.

True or False: Deleting an AWS Lambda function will delete all its associated versions and aliases.

Answer: True

Explanation: When you delete an AWS Lambda function, all its associated versions and aliases are also deleted.

True or False: An AWS Lambda version has a unique ARN (Amazon Resource Name).

Answer: True

Explanation: When you publish a version of your AWS Lambda function, this version has an Amazon Resource Name (ARN) distinct from the ARN of the original function.

What doesn’t change when you publish a new version of your lambda function?

  • a) The $LATEST pointer
  • b) The function code
  • c) The configuration settings
  • d) The function’s ARN

Answer: a) The $LATEST pointer

Explanation: The $LATEST pointer always points to the most recently published version of your function.

True or False: You cannot add permissions to a specific version or an alias.

Answer: False

Explanation: You can add IAM permissions to a specific version or an alias of a Lambda function.

What is the difference between AWS Lambda Versions and Aliases?

  • a) Aliases are mutable while versions are not.
  • b) Versions are mutable while Aliases are not.
  • c) There is no difference.
  • d) Aliases and versions are both mutable.

Answer: a) Aliases are mutable while versions are not.

Explanation: A version is an immutable snapshot of the function’s code and configuration. An alias, on the other hand, is a mutable reference to a version.

Interview Questions

What is an AWS Lambda version?

In AWS Lambda, a version is a snapshot of your function code allowing developers to record incremental development over time.

What is the unique immutable identifier of a Lambda function version?

The unique immutable identifier of a Lambda function version is its Amazon Resource Name (ARN).

How can AWS Lambda versions help in deployment?

AWS Lambda versions can help in deployment by allowing users to manage their code’s switching from one version to another seamlessly without downtime.

Explain the concept of aliases in AWS Lambda.

Aliases in AWS Lambda are essentially pointers to a specific AWS Lambda function version, which allows developers to switch between different versions of a function without modifying the client application.

What is the use of the $LATEST version in AWS Lambda?

The $LATEST version in AWS Lambda is a special alias that automatically points to the last function you created so that you can test and make modifications to your code.

Can you modify an existing version in AWS Lambda?

No, versions in AWS Lambda are immutable i.e., once a version is published, its code and most of its settings can’t be changed.

Can you delete a version of a function in AWS Lambda?

Yes, for a function in AWS Lambda, you can delete any version except for the $LATEST version.

Can one Alias point to multiple Lambda versions?

No, an Alias in AWS Lambda is simply a pointer and can only point to one specific Lambda function version at a time.

What is traffic shifting feature in AWS Lambda?

Traffic shifting in AWS Lambda allows developers to instruct an alias to split invocation traffic between two function versions, which is helpful in implementing canary deployments and blue/green deployments strategies.

Is it a good practice to directly invoke the $LATEST version of a Lambda function?

No, it is not recommended to directly invoke the $LATEST version in a production environment because it may contain experimental code. It is a good practice to use versions and aliases for this purpose.

How can you assign different levels of permissions to a particular function version in AWS Lambda?

You can assign IAM policies to the unique ARN of the lambda function version to provide different levels of permissions.

Can you update an alias to point to a different version in AWS Lambda?

Yes, you can easily reassign an existing alias to a new version in AWS Lambda.

When using AWS SAM, how do you auto-publish a new version every time the function code changes?

In AWS SAM, you can use the AutoPublishAlias property in your serverless function definition to push a new version of your AWS Lambda function every time the function code changes.

Can you have multiple aliases pointing to a single version in AWS Lambda?

Yes, multiple aliases can point to the same version in AWS Lambda.

Can you rollback deployment in Lambda?

Yes, since each deployment creates a new version, you can rollback by updating the alias to point it to the previous version.

Leave a Reply

Your email address will not be published. Required fields are marked *