Select to view content in your preferred language

Installing minimum dependencies for use with AWS Lambda

738
5
05-09-2023 10:34 PM
AnthonyRyanEQL
Frequent Contributor

I'm looking at using ArcGIS Python API in an AWS Lambda function. I have installed all of the minimum dependencies based on Install and Setup | ArcGIS API for Python but some of these dependencies seem to be an overkill when used in AWS. Would the kerberos & ntlm packages actually be required and probably the same with oauthlib?

At the moment, I leaning towards ujson, six & requests are probably the bare minimum for AWS Lambda.

It would be great to find out the actual bare minimum per scenario (eg. If server/portal using local win accounts then only ujson, six & requests are required, etc)

Thanks for any help with this.

0 Kudos
5 Replies
EarlMedina
Esri Regular Contributor

I've run into the Lambda deployment size limitation in the past, so I understand your predicament. What functionality do you need from the Python API? On at least one occasion, it was easier to just write a custom class for my Lambdas that handled the essentials. I was doing simple stuff like querying a service to generate a report.

0 Kudos
AnthonyRyanEQL
Frequent Contributor

Earl,

The use case I'm looking at this for CI/CD pipeline. Storing artifacts in S3 bucket (eg. sd files, mapx files, json for web maps) and then invoking lambda via a schedule to take these artifacts from S3 and publish them into ArcGIS Enterprise.

I'm thinking of building a docker file and using it that way instead now.

At the moment, I'm getting an error in loading the packages 'asn1' cannot be found for the crypto package

0 Kudos
RKatz
by
Emerging Contributor

HI - if I can re-open this thread -

My use case is, to pull a latitude/longitude from a MapServiceLayer Docs :

      from arcgis.mapping import MapServiceLayer

      map_service_layer = MapServiceLayer(url='...../GISViewer/MapServer/57')

      feature_set=map_service_layer.query(where='', text=text)

      featureset.to_json

this seems like a fairly small-sized package, but I am currently forced to load a Docker image when I run this lambda; any suggestions on fitting the software for MapServiceLayer into a lambda layer would be by me appreciated.

Thank you!

0 Kudos
AnthonyRyanEQL
Frequent Contributor

RKatz,

You don't need the arcgis python api to do this.

Using the requests module and send a GET request to your url (eg. url='...../GISViewer/MapServer/57/query?f=json&token=.....) will return json data

RKatz
by
Emerging Contributor

worked like a charm

0 Kudos