AWS - LambdaYou want to share a custom logging library across multiple Lambda functions in different AWS accounts. What is the best approach using Lambda layers?APublish the layer as a public layer and reference its ARN in each accountBCopy the layer code into each function's deployment packageCCreate the layer in one account and share the function code onlyDUse environment variables to pass the library codeCheck Answer
Step-by-Step SolutionSolution:Step 1: Understand cross-account sharingLambda layers can be shared publicly or with specific accounts via ARNs.Step 2: Choose best sharing methodPublishing the layer publicly allows all accounts to reference it easily without code duplication.Final Answer:Publish the layer as a public layer and reference its ARN in each account -> Option AQuick Check:Cross-account sharing = public layer ARN [OK]Quick Trick: Publish layers publicly to share across accounts easily [OK]Common Mistakes:MISTAKESCopying code into each function instead of using layersSharing only function code without layersTrying to pass code via environment variables
Master "Lambda" in AWS9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More AWS Quizzes AWS Lambda - Why serverless matters - Quiz 10hard CloudWatch - Default vs custom metrics - Quiz 7medium CloudWatch - Default vs custom metrics - Quiz 14medium DynamoDB - Scan vs query performance - Quiz 10hard DynamoDB - DynamoDB Streams overview - Quiz 6medium Elastic Load Balancing - Cross-zone load balancing - Quiz 9hard RDS and Relational Databases - Launching an RDS instance - Quiz 3easy RDS and Relational Databases - RDS security (encryption, security groups) - Quiz 15hard RDS and Relational Databases - RDS pricing considerations - Quiz 15hard SNS and SQS - SNS notification types (email, SMS, Lambda) - Quiz 3easy