AWS GROBID Deploy
Deploy GROBID on AWS EC2 using Python.
Note: The deployed EC2 GROBID service will be publicly available on the internet. It is best practice (and more "economically sustainable") to always teardown the instance when not in use. Spinning up new instances is fast and easy.
Prerequisites
Before using this tool, ensure you have:
- AWS Account with appropriate permissions (see AWS_PERMISSIONS.md)
- AWS Credentials configured via AWS profiles or environment variables
- Required IAM Permissions for EC2 operations
Quick Setup
# Configure AWS profile
aws configure --profile your-profile-name
# Test your credentials
aws sts get-caller-identity --profile your-profile-name
For detailed setup instructions, see the AWS Permissions Guide.
Usage (Python)
import json
import aws_grobid
import requests
# There are a few different pre-canned configurations available:
# Base GROBID service w/ CRF only models
# aws_grobid.GROBIDDeploymentConfigs.grobid_crf
# Base GROBID service w/ Deep Learning models
# aws_grobid.GROBIDDeploymentConfigs.grobid_full
# Software Mentions annotation service w/ Deep Learning models
# aws_grobid.GROBIDDeploymentConfigs.software_mentions
# NOTE: You also need to change the URL endpoint specified below for Software mentions
# Create a new GROBID instance and wait for it to be ready
# This generally takes about 6 minutes
# Instance is automatically torn down if the
# GROBID service is not available within 7 minutes
instance_details = aws_grobid.deploy_and_wait_for_ready(
grobid_config=aws_grobid.GROBIDDeploymentConfigs.grobid_crf,
)
# You can also specify the instance type, region, tags, etc.
# instance_details = aws_grobid.deploy_and_wait_for_ready(
# grobid_config=aws_grobid.GROBIDDeploymentConfigs.grobid_full,
# instance_type='c5.4xlarge',
# region='us-east-1',
# tags={'awsApplication': 'arn:...'},
# timeout=420, # 7 minutes
# )
# Use the instance to process a PDF file
# The API URL is available from:
# instance_details.api_url
# ...
# Example request to GROBID Server for Annotation
with open("example.pdf", "rb") as open_pdf:
response = requests.post(
f"{instance_details.api_url}/api/processFulltextDocument",
files={"input": open_pdf},
data={"disambiguate": 1},
timeout=180, # 3 minutes
)
response.raise_for_status()
# Write response to XML
with open("example-grobid-annotations.xml", "wb") as open_xml:
open_xml.write(response.content)
# Example request to GROBID Server for Software Mentions
# with open("example.pdf", "rb") as open_pdf:
# response = requests.post(
# f"{instance_details.api_url}/service/annotateSoftwarePDF",
# files={"input": open_pdf},
# data={"disambiguate": 1},
# timeout=180, # 3 minutes
# )
# response.raise_for_status()
# response_data = response.json()
# # Write response to JSON
# with open("example-mentions.json", "w") as open_json:
# json.dump(response_data, open_json)
# Teardown the instance when done
aws_grobid.terminate_instance(
region=instance_details.region,
instance_id=instance_details.instance_id
)
When providing an instance type that has NVIDIA GPUs available (G* or P* families), we automatically pass the GPU flag to Docker so GROBID can use the GPU.
Note: The first call to the GROBID service may take a minute or so to warm up. Subsequent calls are much faster.
We automatically pick up .env-controlled environment variables. This is useful for setting AWS_PROFILE or AWS_SECRET_ACCESS_KEY and AWS_ACCESS_KEY_ID.
CLI
After installing the package, a CLI is available as aws-grobid.
- Deploy and wait until ready (prints instance details as JSON):
# Deploy with default credentials
aws-grobid deploy --config crf --instance-type m6a.4xlarge --region us-west-2 \
--tag awsApplication=example --timeout 420
# Deploy with specific AWS profile
aws-grobid deploy --config crf --instance-type m6a.4xlarge --region us-west-2 \
--tag awsApplication=example --timeout 420 --profile your-profile-name
- Terminate an instance:
# Terminate with default credentials
aws-grobid terminate --region us-west-2 --instance-id i-0123456789abcdef0
# Terminate with specific AWS profile
aws-grobid terminate --region us-west-2 --instance-id i-0123456789abcdef0 \
--profile your-profile-name
Note: 'lite' remains available as a deprecated alias for 'crf' for backward compatibility.
Optional: better typing in editors
If you want precise types for the boto3 clients/resources in your IDE or mypy, install the dev extras:
pip install -e ".[dev]"
This includes boto3-stubs[ec2] and enables rich autocompletion and type checking without affecting runtime.
Release files for aws-grobid 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| aws_grobid-0.3.0.tar.gz | 25.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| aws_grobid-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 47.5 kB
Release files / aws_grobid-0.3.0.tar.gz
| Download URL | aws_grobid-0.3.0.tar.gz |
|---|---|
| Size | 25.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ed9b8e8dff5f42352e1d0ed5f42e31022d1171f6e36d0ca5f3afe7be15c66018
|
|
BLAKE2b-256 checksum How to use checksums |
0e271a219bf43ecadc4764e518017635a205d8545d92b96103e6f3ec8a3d2619
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 15, 2026.
Transparency logRelease files / aws_grobid-0.3.0-py3-none-any.whl
| Download URL | aws_grobid-0.3.0-py3-none-any.whl |
|---|---|
| Size | 22.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ab2eb5e8b5e1836741b8ff269be07796f1bb99efb0d6c9026eb352b468b4a3a2
|
|
BLAKE2b-256 checksum How to use checksums |
0cdbd11cf94da3f831d672b312657e20f06b951e2ccef24cbbf2d289e116762e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 15, 2026.
Transparency log