Comments (2)
Thanks for raising this feature request. Was there a particular way you were building the layer? Defining a layer as such:
HelloWorldLayer:
Type: AWS::Serverless::LayerVersion
Properties:
ContentUri: ./layer
CompatibleRuntimes:
- provided.al2
CompatibleArchitectures:
- x86_64
Metadata:
BuildMethod: makefile
With a random requirements.txt
and a Makefile
in the ./layer
folder:
# ./layer/Makefile
build-HelloWorldLayer:
# my system does not have yum, AL2 provided does
yum --version
mkdir -p "$(ARTIFACTS_DIR)/python"
python3 -m pip install -r requirements.txt -t "$(ARTIFACTS_DIR)/python"
Running sam build -u HelloWorldLayer
seems to pull the provided AL2 build image and installed requirements successfully.
from aws-sam-cli.
@lucashuy Thanks for the info, I compared your snippet to our templates and everything was identical except for the CompatibleRuntime setting which was set to python3.8
in our case.
I ran the SAM build command just for the layer resource as you did, and now it turns out the correct image gets used when building (whether I specify provided.al2
or python3.8
, in both cases I get an AL2 based image). I took another look at our template and noticed there was also one lambda function in there with Runtime: provided
.
It seems that SAM CLI prefers the provided
runtime over our explicitly specified python3.8
compatible runtime for the layer when we build the entire stack via sam build
. I'm not sure if that's correct behaviour, because the provided
runtime appears to be the only one using a different AmazonLinux version compared to the rest of the runtimes. To me it seems to be the 'least' compatible, while SAM CLI output says:
For container layer build, first compatible runtime is chosen as build target for container.
Do you recommend I open a bug around this behaviour, or does first compatible runtime
mean any existing runtime image in this context?
from aws-sam-cli.
Related Issues (20)
- Cannot sam local start-api without specifying an image HOT 1
- Bug: sam local start-api - ReadTimeout HOT 3
- Bug: "Timed out while attempting to establish a connection to the container" error after fresh install of Docker and AWS SAM HOT 5
- Bug: sam build - JSONDecodeError HOT 1
- Bug: No new Lambda Versions are deployed with Lambda configurations changes HOT 2
- Bug: Change Parameter's Default value doesn't reflect HOT 4
- Bug: AWS ADOT LAMBDA layer stuck when using local invoke HOT 5
- Bug: AWS::Serverless::Function `ImageUri` with map (ex: using `!Sub`) fails with type error HOT 7
- Access to internal enterprise host (Github entreprise) HOT 1
- Bug: sam deploy - ConnectionError HOT 2
- Bug: Invoke failed error=ErrAgentNameCollision HOT 4
- Bug: SAM Doesn't recognize changes related to intrinsic functions (#6610) HOT 1
- Bug: Error: The runtime 'provided.al2023' is unsupported. (golang) HOT 6
- `BuildMethod: esbuild` does not include bundled files HOT 2
- Bug: AWS::Events::Rule EventBusName -> 'name' member must satisfy regular expression pattern [\.\-_A-Za-z0-9]+ HOT 4
- Api Gateway requests with query string always response 400 HOT 2
- Bug: python 3.12 with setuptools installed and distutils still being required. HOT 2
- VStudio Debug for Typescript Lambda function gives Runtime.ImportModuleError HOT 5
- Feature request: Support for Python requirements files with different names HOT 3
- Bug: "sam build - TypeError" When building Docker Image from documentation HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aws-sam-cli.