Sync Labels to Cloud Storage
Automatically save labels to AWS S3
Typically, after labeling your data with Encord, the labels are used to training your ML models. This process typically includes transferring your labels to cloud storage. To streamline this, follow the steps below to automatically save your labels to your cloud storage upon their creation:
- Create an IAM policy for a Lambda function.
- Paste the following JSON into the JSON policy editor, replacing
<BUCKET_NAME>
with the name of the S3 bucket you want to export your labels to.
-
Create an IAM role for Lambda, and attach the policy you created in Step 1.
-
Create a new directory on your computer to store the components for your container image. The directory must include:
- The lambda function script provided below. You must replace <s3_bucket_name> with your S3 bucket name. We recommend saving the script as
lambda_function.py
. - The docker file provided below.
- A text file named
access-key
to store your private key. The key is used for authentication with Encord.
Creating a file called access-key
to store your private key path is the simplest way, but not a secure way of ensuring the Lambda function can authenticate with Encord. Alternatives include, but are not limited to:
-
Create a private ECR repository in AWS to store your container image. Record the path to the ECR repository you create.
-
Create a Docker container image for the Lambda function. Use the command line to navigate to the directory you created in step 4. The following command shows an example with a tag containing a version number appended to the repository path:
- Push your container image to the private ECR repository you created in step 5. The following command shows an example with a tag containing a version number appended to the repository path:
- Create a Lambda function in AWS.
- Select the Container image option.
- Give the Lambda function a meaningful name.
- Click Browse images and select the container image from your ECR repository.
- Select the role you created in step 3 as the Execution role.
-
Add a trigger for the Lambda function. Record the URL.
-
In Encord, set up a webhook on the Complete stage of your Project to send label information to your Lambda function. Use the URL of the trigger you created in step 8 for the webhook. The payload sent out by the webhook can be seen here.
Was this page helpful?