@@ -12,41 +12,47 @@ Resources:
1212 EmptyLambdaLayer :
1313 Properties :
1414 ServiceToken :
15- Fn::ImportValue : !Sub "cfn:lambdalayer:${AWS::Region}:arn"
15+ Fn::ImportValue : !Sub "cfn:lambdalayer-x86-64 :${AWS::Region}:arn"
1616 Name : test-gracefull-exit
17- Region : !Ref "AWS::Region"
1817 Type : Custom::LayerBuilder
1918
2019 Boto3LambdaLayer :
2120 Properties :
2221 ServiceToken :
23- Fn::ImportValue : !Sub "cfn:lambdalayer:${AWS::Region}:arn"
22+ Fn::ImportValue : !Sub "cfn:lambdalayer-x86-64 :${AWS::Region}:arn"
2423 Name : boto3-latest
25- Region : !Ref "AWS::Region"
2624 requirements :
2725 - boto3
2826 Type : Custom::LayerBuilder
2927
30- TropoLambdaLayer :
28+ RequestsLambdaLayer :
3129 Properties :
3230 ServiceToken :
33- Fn::ImportValue : !Sub "cfn:lambdalayer:${AWS::Region}:arn"
34- Name : cfn-account-policy
35- Region : !Ref "AWS::Region"
31+ Fn::ImportValue : !Sub "cfn:lambdalayer-x86-64:${AWS::Region}:arn"
32+ Name : requests-latest
3633 requirements :
37- - " troposphere>2.3.0"
38- - " awacs==0.7.2"
34+ - requests
35+ Type : Custom::LayerBuilder
36+
37+ # Pydantic has a compiled pydantic-core dependency; the builder's arch must
38+ # match the consumer function's arch. x86_64 builder → x86_64 consumer.
39+ PydanticLambdaLayer :
40+ Properties :
41+ ServiceToken :
42+ Fn::ImportValue : !Sub "cfn:lambdalayer-x86-64:${AWS::Region}:arn"
43+ Name : pydantic-latest
44+ requirements :
45+ - pydantic
3946 Type : Custom::LayerBuilder
4047
4148 InlineCodeLambdaLayer :
4249 Properties :
4350 ServiceToken :
44- Fn::ImportValue : !Sub "cfn:lambdalayer:${AWS::Region}:arn"
51+ Fn::ImportValue : !Sub "cfn:lambdalayer-x86-64 :${AWS::Region}:arn"
4552 Name : inline-code-only
46- Region : !Ref "AWS::Region"
4753 filename : eratosthenes.py
4854 filecontent :
49- Fn::Base64 : !Sub |
55+ Fn::Base64 : |
5056 def sieve(n) :
5157 # https://wikipedia.org/wiki/Sieve_of_Eratosthenes
5258 return sorted(
@@ -61,19 +67,29 @@ Resources:
6167 InlineCodeWithPipPackageLambdaLayer :
6268 Properties :
6369 ServiceToken :
64- Fn::ImportValue : !Sub "cfn:lambdalayer:${AWS::Region}:arn"
70+ Fn::ImportValue : !Sub "cfn:lambdalayer-x86-64 :${AWS::Region}:arn"
6571 Name : inline-code-and-requirements
66- Region : !Ref "AWS::Region"
6772 requirements :
6873 - python-whois
6974 filename : module.py
7075 filecontent :
71- Fn::Base64 : !Sub |
76+ Fn::Base64 : |
7277 from whois import whois
7378 def examine(domain) :
7479 return whois(domain)
7580 Type : Custom::LayerBuilder
7681
82+ # Same requirements, different arch: call the arm64 builder. C extensions
83+ # get built natively for arm64 so Graviton consumer functions work.
84+ Arm64BotoLambdaLayer :
85+ Properties :
86+ ServiceToken :
87+ Fn::ImportValue : !Sub "cfn:lambdalayer-arm64:${AWS::Region}:arn"
88+ Name : boto3-latest-arm64
89+ requirements :
90+ - boto3
91+ Type : Custom::LayerBuilder
92+
7793 LambdaExecutionRole :
7894 Type : ' AWS::IAM::Role'
7995 Properties :
@@ -105,24 +121,25 @@ Resources:
105121 Description : ' Show lib version from the layers'
106122 Code :
107123 ZipFile : |
108- import troposphere
109124 import boto3
125+ import pydantic
126+ import requests
110127 from lambdalayer.module import examine
111128 from lambdalayer.eratosthenes import sieve
112129
113130 def lambda_handler(event, context):
114- print("Tropo version: {}".format(troposphere.__version__))
115- print("Boto3 version: {}".format(boto3.__version__))
116- print("Sieve of Eratosthenes from 10: {}".format(sieve(10)))
117- print("WhoIs example.com: {}".format(examine('example.com')))
118-
119-
131+ print(f"boto3 version: {boto3.__version__}")
132+ print(f"pydantic version: {pydantic.VERSION}")
133+ print(f"requests version: {requests.__version__}")
134+ print(f"Sieve of Eratosthenes from 10: {sieve(10)}")
135+ print(f"WhoIs example.com: {examine('example.com')}")
120136 Handler : index.lambda_handler
121- Runtime : python3.7
137+ Runtime : python3.14
122138 Timeout : 60
123139 Role : !GetAtt LambdaExecutionRole.Arn
124140 Layers :
125141 - !GetAtt Boto3LambdaLayer.Arn
126- - !GetAtt TropoLambdaLayer.Arn
142+ - !GetAtt RequestsLambdaLayer.Arn
143+ - !GetAtt PydanticLambdaLayer.Arn
127144 - !GetAtt InlineCodeWithPipPackageLambdaLayer.Arn
128145 - !GetAtt InlineCodeLambdaLayer.Arn
0 commit comments