Practice Test

True or False: Environment variables in AWS Lambda are encrypted by default.

  • True
  • False

Answer: True

Explanation: AWS Lambda environment variables are encrypted at rest in the AWS Key Management Service (KMS).

What are AWS environment variables used for?

  • A. To store sensitive data like passwords
  • B. To configure software and libraries
  • C. To pass operational parameters to your application
  • D. All the above

Answer: D. All the above

Explanation: AWS environment variables serve many purposes, including storing sensitive data, configuring software and libraries, and passing operational parameters.

True or False: Environment variables in AWS are case-insensitive.

  • True
  • False

Answer: False

Explanation: Environment variables are case-sensitive. A common convention is to declare them using all uppercase letters.

In AWS Lambda, environment variable values can be stored in which of the following ways?

  • A. Plain text
  • B. Encrypted with a customer-managed AWS Key
  • C. Encrypted with an AWS-managed key
  • D. All of the above

Answer: D. All of the above

Explanation: AWS Lambda allows you to store environment variable values in plain text, or encrypted with a customer-managed or AWS-managed key.

True or False: One can use environment variables to parameterize application’s behavior without changing the AWS Lambda function code.

  • True
  • False

Answer: True

Explanation: Yes, environment variables in AWS Lambda can be used to adjust the behavior of the application without making changes to code.

Which of the following Amazon services does not support environment variables?

  • A. Amazon RDS
  • B. Amazon ECS
  • C. Amazon S3
  • D. Amazon Lambda

Answer: C. Amazon S3

Explanation: Amazon S3 is a storage service and does not support the use of environment variables like RDS, ECS, or Lambda.

True or False: You can not encrypt environment variables with AWS KMS but you can mask them.

  • True
  • False

Answer: False

Explanation: You can encrypt environment variables using AWS KMS. However, AWS does not provide a feature to mask environment variables.

Which of the following is not a best practice when using environment variables in AWS?

  • A. Do not store sensitive information in plain text
  • B. Embed configurations directly in your application
  • C. Use encryption helpers to decrypt secure environment variables
  • D. Use AWS Secrets Manager for handling sensitive data

Answer: B. Embed configurations directly in your application

Explanation: It is not advisable to embed configurations directly in your application. Instead, use environment variables.

True or False: As environment variables are case-sensitive, “Var” and “var” would be treated as two different variables in AWS.

  • True
  • False

Answer: True

Explanation: Yes, “Var” and “var” would indeed be treated as two different variables due to the case-sensitive nature of environment variables.

To provide your Lambda function with access to AWS services, you can use:

  • A. Execution role
  • B. AWS S3 bucket
  • C. Environment variables
  • D. Both A and C

Answer: D. Both A and C

Explanation: AWS services can be accessed by a Lambda function either via execution role or by setting environment variables. AWS S3 bucket is a storage service and not related to access provision.

Interview Questions

What are Environment Variables in AWS Lambda?

Environment variables in AWS Lambda allow you to dynamically pass settings to your function code and libraries, without making changes to your code.

On AWS, how can you secure environment variables?

On AWS, environment variables are encrypted at rest and in transit. Also, sensitive information can be stored in AWS Secrets Manager or AWS Systems Manager Parameter Store, and then retrieved it from your Lambda function code.

Can you configure environment variables for AWS Lambda functions at the time of creation?

Yes, you can configure environment variables for AWS Lambda function both at the time of creation and after function creation.

At what granularity do environment variables apply in AWS Lambda?

In AWS Lambda, environment variables apply at the function-level. You can use the same environment variable for different Lambda functions, but they would hold different values.

When do changes to environment variables become effective in AWS Lambda?

The changes to environment variables take effect immediately. If the function is executing while you change an environment variable, we recommend forcing a checkpoint for stateful applications to capture the changes.

How are environment variables passed to AWS Lambda functions?

Environment variables are passed to AWS Lambda function through a mapping that you create in the AWS Lambda console, command-line interface (CLI), or SDKs.

How many environment variables can you configure per AWS Lambda function?

You can configure up to 4 KB of environment variables per AWS Lambda function.

What happens when an AWS Lambda function accesses an undeclared environment variable?

If a Lambda function attempts to access an undeclared environment variable, an empty string is returned.

Can you use environment variables in your AWS Lambda function to store sensitive data?

While it’s possible, AWS recommends storing sensitive data in AWS Secrets Manager or AWS Systems Manager Parameter Store, not directly in environment variables.

In AWS Elastic Beanstalk, how would you add an environment variable?

In Beanstalk Console, choose Configuration, then Software. Under Environment Properties, you can add a property name and value and then apply the changes.

Are AWS Elastic Beanstalk environment variables encrypted?

By default, environment variables in Elastic Beanstalk are not encrypted. For better security, you can utilize AWS Key Management Service(KMS) to encrypt environment variables.

What happens when you modify an environment variable in AWS Elastic Beanstalk?

Modifying an environment variable in AWS Elastic Beanstalk will restart your application servers and apply the new environment variable value.

Can environment variables in AWS Lambda be shared across multiple functions?

No, environment variables in AWS Lambda are isolated at the function level. Each function has its own environment variables.

Can environment variables in AWS Lambda be updated using the AWS CLI?

Yes, the AWS CLI provides commands to update the environment variables of a Lambda function.

What’s the maximum size for all environment variables in an AWS Lambda function?

The total unencrypted size of all environment variables cannot exceed 4 KB.

Leave a Reply

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