계층으로 AWS CloudFormation 작업 - AWS Lambda

계층으로 AWS CloudFormation 작업

AWS CloudFormation을 사용하여 계층을 생성하고 해당 계층을 Lambda 함수와 연결할 수 있습니다. 다음 예제 템플릿에서는 my-lambda-layer라는 계층을 만들고 계층 속성을 사용하여 Lambda 함수에 계층을 연결합니다.

--- Description: CloudFormation Template for Lambda Function with Lambda Layer Resources: MyLambdaLayer: Type: AWS::Lambda::LayerVersion Properties: LayerName: my-lambda-layer Description: My Lambda Layer Content: S3Bucket: amzn-s3-demo-bucket S3Key: my-layer.zip CompatibleRuntimes: - python3.9 - python3.10 - python3.11 MyLambdaFunction: Type: AWS::Lambda::Function Properties: FunctionName: my-lambda-function Runtime: python3.9 Handler: index.handler Timeout: 10 Policies: - AWSLambdaBasicExecutionRole - AWSLambda_ReadOnlyAccess - AWSXrayWriteOnlyAccess Layers: - !Ref MyLambdaLayer