2

do you know if there exists a way to use yum from inside a Lambda function. For example, I need to install mdbtools, but if in my lambda I write (in Python)

subprocess.run(['yum', 'install', 'mdbtools'])

then it says

[ERROR] FileNotFoundError: [Errno 2] No such file or directory: 'yum'

I also tried with

os.system('yum install mdbtools')

but it says

sh: yum: command not found

Finally, I read from here to enable also the EPEL repository, so I tried with

os.system('sudo amazon-linux-extras install epel -y; sudo yum-config-manager --enable epel; yum install mdbtools')
os.system('sudo amazon-linux-extras install epel -y; sudo yum-config-manager --enable epel; yum install mdbtools')
os.system('sudo amazon-linux-extras install epel -y; sudo yum-config-manager --enable epel; yum install mdbtools')

but again I get

sh: sudo: command not found
sh: sudo: command not found
sh: yum: command not found

Can you help? Thanks in advance.

shot22
  • 189
  • 1
  • 8

2 Answers2

1

If yum existed in the Lambda environment, it should be in /bin/yum. I've looked there, and don't see it, so I'm going to assume that you won't be able to run it.

If you need a library that can't be packaged in a deployment bundle, you'll need to use a Lambda Container Image. Start with one of the pre-built base images, and run yum in your Dockerfile.

However, I see that you've tagged this question with ms-access. If you're trying to install a Microsoft product in a the Linix-based Lambda environment, you'll need to do a lot more than just run yum.

Parsifal
  • 3,928
  • 5
  • 9
0

This is not how it is intended to work with dependencies in Lambdas.

It can be achieved in another way though. You should include all the libs and dependencies in your .zip file which you upload. More information on that here.

Robert Kossendey
  • 6,733
  • 2
  • 12
  • 42
  • You use yum to install system libraries, which can't be packaged in a deployment bundle. – Parsifal Apr 07 '21 at 16:46
  • I get that, but this is not what Lambda is intended for. There is the possibility though, to include yum packages as written in the linked post. – Robert Kossendey Apr 07 '21 at 16:51