Update Expiry of Vouchers

Bulk update voucher expiry dates and statuses in DynamoDB.

Common Use Cases

1. Extend Expiry of Active Vouchers

Extend the expiry date of vouchers that are still available.

  • Old status: available
  • New status: available
  • Effect: Updates vouchers with a later expiry date, keeps status unchanged.

2. Reactivate Expired Vouchers

Reinstate vouchers that were previously marked as expired.

  • Old status: expired
  • New status: available
  • Effect: Moves vouchers back into circulation, adjusts prize counters.

3. Expire Active / Redeemed Vouchers

Force vouchers into the expired state.

  • Old status: available, redeemed, or claimed
  • New status: expired
  • Effect: Prevents further use of vouchers, decrements total_available, increments total_expired.

4. Partitioned Prize Updates

For large campaigns where vouchers are partitioned across multiple DynamoDB shards.

  • Script automatically detects total_partitions in the prize metadata.
  • Vouchers are queried and updated across all partitions.
  • active_partition is updated accordingly.

Example Input

{
  "awsProfile": "bronze",
  "awsStage": "beta",
  "configId": "config123",
  "prizeArg": "prize789",
  "expiryArg": 1735689600000,
  "oldStatusArg": "available",
  "newStatusArg": "expired"
}

Failure Handling & Logs

ThrottlingException → DynamoDB throttled request, voucher marked as failed. ConditionalCheckFailedException → Voucher status changed during update (skipped). Other errors → Logged to file. Failed updates are written to a JSON file:

FailedItems-logFile-2025-08-25T18-45-12.345Z.json