Responses for batch results

What’s the best response shape for a batch request?

Depending on your design, batch requests don’t always work and need success and failure responses back from the endpoint.

Salesforce return the item and a success field in each response item:

[
  {
    "success" : true,
    "created" : true,
    "id" : "1",
    "errors" : []
  },
  {
    "success" : false,
    "created" : false,
    "id" : "2",
    "errors" : ['example error message']
  }
]

The AWS DynamoDB response returns a set of metadata, successes and failures:

{
  { 
    "ConsumedCapacity" : 100, 
    "OtherMetric" : true
  },
  { 
    "Items" : [ 
      { "Key" : "Item1" }, 
      { "Key", "Item2" }
    ]
  },     
  { 
    "Failed": [ 
      { "Key" : "Item3", "Reason" : "Value cannot be null" } 
    ]
  }
}

I prefer a third option, which takes the best of both. Return a list of ids you’ve received, so requests can be tracked. Return an array of items that were successful and another list that has failed. The failed messages get an array of reasons they have failed.

{
  "ids" : [ "item1", "item2", "item3" ],
  "success" : [ { id: "item1" }, { id: "item2" } ],
  "failed" : [ { "id": "item2", "reasons" : [ "String required" ] } ]
}

References:

Mounting and diagnosing an EC2 volume from a rescue instance

Here’s a quick way to troubleshoot logs on a failing EC2 with an attached volume.

  1. Remove the instance from any load balancers so it won’t be dropped from a healthcheck
  2. Take a snapshot of the volume you’re having trouble with
  3. Create a rescue instance in the same AWS Account and using the Ec2 Add Storage step attach a new volume which uses the snapshot you created mapped to device xvd*
  4. Start up your instance and connect remotely
  5. Using diskmgmt.msc browse and mount the drive
  6. Use file explorer to find your device and explore as a regular hard drive

Having trouble mapping your device? See Mapping Disks to Volumes on your EC2 instance for the documentation on the device names.