How do I troubleshoot "Unexpected token. Remainder of the file will not be processed." error when I import data from Amazon S3 to DynamoDB?

2 minute read
1

When I import data from Amazon Simple Storage Service (Amazon S3) to Amazon DynamoDB, the import fails and I get the following error: “Unexpected token. Remainder of the file will not be processed."

Resolution

To troubleshoot this error, review the data format, compression type, and path of your Amazon S3 objects. The data in your Amazon S3 bucket must be in CSV, DynamoDB JSON, or ION format. The data must be compressed only with GZIP or ZSTD. No other type of compression can be used, and the data must not be compressed at all.

To review this information, complete the following steps:

  1. Open the DynamoDB console.

  2. In the navigation pane, choose Imports from S3.

  3. On the Import options page, enter the source S3 URL up to the .../data folder. For example, specify the import ARN in the following format:
    s3://my-bucket/AWSDynamoDB/<hyphen_separated_foldername>/data/

  4. Enter the following information:
    For Import file format, choose CSV, DynamoDB JSON, or ION.
    For Import file compression, choose GZIP, ZSTD, or None.
    Note: If the S3 source bucket type is gz, then select GZIP.
    The following example has a gz file type:

    {
     "itemS3Pointer": {
     "bucket": "test",
     "key": "AWSDynamoDB/01714549541xxxx-1ab21b72/data/am2dghk2om7epke3wrnn3sgz24.json.gz"
     },
     "importArn": "arn:aws:dynamodb:eu-west-1:79205873xxxx:table/new1/import/01714550075760-3658717a",
     "errorMessages": [
     "Unexpected token. Remainder of the file will not be processed."
     ]
    }
  5. Choose Next.

  6. Enter the Destination table details.

  7. Choose Import.

The import takes a few minutes. You can track the status of your import on the Imports from S3 page.

AWS OFFICIAL
AWS OFFICIALUpdated 15 days ago