Type | File size limits | Ease of use |
---|---|---|
Zip upload | 50MB (250MB unzipped) | easier |
Docker | NA | harder |
pip install encord-agents[vision]
). Additionally, dependencies relying on C/C++ code require specific CPU architecture installations, often making testing only possible after deployment.
More detailed AWS Documentation on python lambda functions can be found here.
venv
), and a package directory for CPU-architecture-specific dependencies tailored to your cloud infrastructure.
encord-agents
. Refer to the installation docs for detailed instructions.boto3
, the AWS SDK, even though it’s typically present in Lambda environments. This ensures consistent dependency versions and avoids unexpected changes when AWS updates its infrastructure.lambda_function.py
file using the following template:lambda_function.py
and your function lambda_handler
if you are following this example, as these names are referenced in the --handler
argument in Step 6.lambda_handler
function with the logic you want to execute when the agent is triggered.venv
and not the package
that is uploaded to AWS, so we might see slight differences in the outcome.if __name__ == "__main__"
declaration in the end of the file as follows:package
directory:trust-policy.json
to be uploaded to AWS.Arn
.
<lambda_function_name>
you want to use and the proper role Arn
from STEP 5.create-function
from the AWS CLI.requirements.txt
file.
lambda_function.py
file using the following template:lambda_function.py
and your function lambda_handler
if you’re following this example, as these names are referenced in the Docker image in the next step.lambda_handler
function with the logic you want to execute when the agent is triggered.
Dockerfile
with the following content.docker
and buildx
installed.ENCORD_SSH_KEY
env variableamd64
(or arm64
see aws docs)encord-agents-example:latest
in this example)curl
command. The functions/function/invocation
path is required by Amazon.
Content-Type
: Locally, the container expects a post request with Content-Type: application/x-www-form-urlencoded
while the public url hosted by AWS expects Content-Type: application/application-json
.POST
data: Locally, the post data needs to be {"body": {... content dict}}
while the public url expects {... content dict}
.curl
request for a publicly hosted lambda function would be:aws get-login-password
command to authenticate the Docker CLI to your Amazon ECR registry.--region
value to the AWS Region where you want to create the Amazon ECR repository (we use eu-west-1
in this example).repositoryUri
from the output.
docker tag
command:encord-agents-my-agent-name:latest
is the name and tag of your local Docker image. This is the image name and tag that you specified in the docker build
command above.<ecr-repository-uri>
with the repositoryUri
that you copied above. Make sure to include :latest
at the end of the URI.docker push
command to deploy your local image to the Amazon ECR repository. Ensure you include :latest
at the end of the repository URI.trust-policy.json
to be uploaded to AWS.Arn
.
ImageUri
, specify the repository URI from Step 5. Ensure you include :latest
at the end of the URI.
NONE
for Auth type.https://app.encord.com
, https://app.us.encord.com
, or your custom (VPC) domain.content-type
and x-encord-editor-agent
values.POST
.ENCORD_SSH_KEY
variable, along with any other necessary credentials (for example, HuggingFace, OpenAI, or Gemini).