Skip to content

Conversation

@ghukill
Copy link
Contributor

@ghukill ghukill commented Oct 14, 2025

Purpose and background context

This PR updates the pipeline lambdas repository to use AWS SAM for local testing. As noted in the git commit, SAM provides some affordances that the AWS Lambda Docker image does not:

  • simulate actual HTTP requests versus normal/direct invocations (ETL StepFunction uses normal/direct)
  • handling of AWS credentials in the docker container (hugely helpful)
  • simulating resources constraints

This change is inline with some other more recent lambda repositories like the APT tool and s3-bagit-validator.

Additionally, this PR tries to bring the documentation + code more inline with the current state of the pipeline lambda(s), where effectively we've always had one lambda and will likely continue that way for the foreseeable future. As such, some old code like ping.py was removed which was stubbing a distinct lambda handler.

This work is setup for the "actual" work in USE-86.

How can a reviewer manually see the effects of these changes?

Follow the directions in the new README section, "Running Locally with AWS SAM".

The example command in the Makefile sugggests how we could create example JSON input payloads for other functionality we want to test, either as a persisting fixture, or just ad-hoc during development.

Includes new or updated dependencies?

YES: includes the current pip-audit workaround

Changes expectations for external applications?

NO

What are the relevant tickets?

Why these changes are being introduced:

Previously, local testing was performed by building a Docker container
and issuing HTTP requests against the container that simulated an
invocation (to be specific, this was not a true HTTP invocation of the lambda
but instead a convenience wrapper in the Docker image to field "regular"
invocations via HTTP requests).  While functional, it does not provide a lot
of the affordances and conveniences of AWS SAM, including:

- explicit HTTP versus regular/direction invocation
- handling of AWS credentials for the running container
- simulation of resources

Related, while the repository is named "timdex-pipeline-lambdas" plural,
it effectively continues to be a single lambda.  It is proposed that we
consider keeping it as a single lambda, but explore introducing more
structured business logic branching in the lambda entrypoint.  It is anticipated
that the pipeline lambda could be helpful for things beyond just CLI command
formatting, at which time attention to entrypoint handling and how we test
will get more important.

How this addresses that need:

Adds AWS SAM scaffolding to the repository, while also updating the
README to guide users towards using this approach.

The `ping.py` module was also removed, which was a placeholder for another
distinct lambda definition.

Side effects of this change:
* Local testing is performed via AWS SAM, which is present in other more
recent AWS Lambda repositories we manage.

Relevant ticket(s):
* https://mitlibraries.atlassian.net/browse/USE-86
@ghukill ghukill force-pushed the USE-86-sam-for-local-testing branch from 8af6346 to 923e6c8 Compare October 14, 2025 19:47
@ghukill ghukill requested a review from a team October 14, 2025 19:48
@ghukill ghukill marked this pull request as ready for review October 14, 2025 19:48
@coveralls
Copy link

Pull Request Test Coverage Report for Build 18508251000

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.03%) to 95.122%

Totals Coverage Status
Change from base Build 17957379629: -0.03%
Covered Lines: 273
Relevant Lines: 287

💛 - Coveralls

Copy link
Contributor

@ehanson8 ehanson8 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works as expected! Great addition, glad SAM is finally making it's way into this repo

@ghukill ghukill merged commit c2280ac into main Oct 14, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants