Command - sam build deploying AWS lambda using aws cli

·

1 min read

  1. Common error encountered:
firstlambda % sam build
Your template contains a resource with logical ID "ServerlessRestApi", which is a reserved logical ID in AWS SAM. It could result in unexpected behaviors and is not recommended.
Building codeuri: /Users/yipkayan/Documents/lambda-aws/awslambdapython/firstlambda/hello_world runtime: python3.9 metadata: {} architecture: x86_64 functions: HelloWorldFunction

Build Failed
Error: PythonPipBuilder:Validation - Binary validation failed for python, searched for python in following locations  : ['/usr/bin/python'] which did not satisfy constraints for runtime: python3.9. Do you have python for runtime: python3.9 on your PATH?
  1. Solution link your python 3.9 executable.
    ln -sf /usr/local/opt/python@3.9/bin/python3.9 /usr/local/bin/
    
    reference: stackoverflow.com/questions/65180787/how-to..