private void cleanupEnvironmentRevisions(@NonNull final EnvironmentId environmentId)
      throws InternalServiceException {

    List<EnvironmentRevision> environmentRevisions = listEnvironmentRevisions(environmentId);
    for (EnvironmentRevision environmentRevision : environmentRevisions) {
      try {
        deleteEnvironmentRevision(environmentRevision);
      } catch (final InternalServiceException e) {
        log.info(
            "Skipping deleting environment revision with environment id %s and environment revision id %s because delete was unsuccessful.",
            environmentRevision.getEnvironmentId(),
            environmentRevision.getEnvironmentRevisionId(),
            e);
      }
    }
  }
Check if environment revisions exist and clean them up.
data-service/src/main/java/com/amazonaws/blox/dataservice/repository/EnvironmentRepositoryDDB.java