@Override
  public Environment getEnvironment(@NonNull final EnvironmentId environmentId)
      throws ResourceNotFoundException, InternalServiceException {

    final String accountIdCluster = environmentId.generateAccountIdCluster();
    try {
      final EnvironmentDDBRecord environmentDDBRecord =
          dynamoDBMapper.load(
              EnvironmentDDBRecord.withKeys(accountIdCluster, environmentId.getEnvironmentName()));
      if (environmentDDBRecord == null) {
        throw new ResourceNotFoundException(ResourceType.ENVIRONMENT, environmentId.toString());
      }
      return environmentMapper.toEnvironment(environmentDDBRecord);
    } catch (final AmazonServiceException e) {
      throw new InternalServiceException(
          String.format(
              "Could not load record with environment id %s and environment name %s",
              environmentId.generateAccountIdCluster(), environmentId.getEnvironmentName()),
          e);
    }
  }
Check if environment revisions exist and clean them up.
data-service/src/main/java/com/amazonaws/blox/dataservice/repository/EnvironmentRepositoryDDB.java