Upload Location Data File

This is the topic abstract



Risk Modeler MRI import APIs enable you to securely connect to Amazon S3 so that you may upload flat files of location data using Amazon S3 API services.

The account flat file contains location exposure data in a structured format. Use the Get credentials and file URI by S3 bucket service get temporary credentials to an S3 bucket and the AWS SDK to upload a flat file of account data to an S3 storage bucket.

Once uploaded to AWS, location data may be imported into the EDM using an MRI job.

Step 1: Define a location file

The location file is a flat file that contains location data in a plain text format.

The location file specifies column headers in the first line of the file. Subsequent lines contain location exposure data. The flat file may use commas, semicolons, or tabs to delimit data values. The file may be saved in the CSV or TXT formats.

The MRI process requires that certain location exposure data fields are included in the flat file. Additional fields may be required depending on the perils associated with a location. Intelligent Risk Platform™ validates data specified in the flat file prior to importing that data into the EDM. If required fields are missing, a validation error is thrown. For a complete list of required fields, see "Import Validations" in the Risk Modeler 2.0 User Guide.

Step 2: Get security credentials and S3 bucket path

The Get S3 path and credentials enables you to fetch the path to an S3 bucket and temporary security credentials that will enable you to upload an flat file of exposure data.

The service requires that you specify the bucketId of an Amazon S3 bucket as a path parameter.

curl --location --request POST 'https://{env_url}/riskmodeler/v1/storage/{{bucketId}}/path' \
--header 'Content-Type: application/json' \
--header 'Authorization: {api_key}' 

The request package identifies the fileInputType, fileName, fileSize, and fileType.

curl --location --request POST 'https://{host}/riskmodeler/v1/storage/{{bucketId}}/path' \
--header 'Authorization: {api_key}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "fileName": "locexp.txt",
    "fileSize": 9105,
    "fileType": "location"

The fileType and fileName attributes are required.

  • The fileInputType attribute identifies the job type (ALM or MRI).
  • The fileName attribute specifies the name of the flat file to be uploaded.
  • The fileSize attribute specifies the size of the flat file in kilobytes.
  • The fileType attribute specifies the type of data contained in the flat file. One of account (account data), risk (location data), reins (reinsurance data), or mapping (mapping data).

If successful, the response returns a 201 status code and base64 encoded temporary security credentials from the AWS Security Token Service.

Step 3: Upload location file to S3

The RMS Risk Modeler API does not provide a custom service for uploading flat file data to S3 buckets. You must use the AWS APIs to manage this process.

In this procedure, you will use the S3 bucket path and temporary user credentials to upload account data to the S3 bucket.

First, you must decode to the accessKeyId, secretAccessKey, sessionToken, and s3Path values and pass the decoded values to a S3 client. The sample code is in Java 8.

private static String base64Decode(String text) {
    return new String(Base64.getDecoder().decode(text));

Pass the decoded accessKeyId, secretAccessKey, and sessionToken to the Amazon getS3Client() method to create an Amazon S3 client.

private static AmazonS3 getS3Client(String accessKey, String secretKey, String sessionToken){
    BasicSessionCredentials sessionCredentials = new BasicSessionCredentials(
    return AmazonS3ClientBuilder.standard()
            .withCredentials(new AWSStaticCredentialsProvider(sessionCredentials))

Amazon TransferManager is a high-level utility for managing transfers to Amazon S3 that makes extensive use of Amazon S3 multipart uploads.

Once you have the Amazon S3 client, you can pass the the s3Client, bucketName, key, and the filePath to the TransferManager.

private static void upload(AmazonS3 s3Client, String bucketName, String key, String filePath) {
    try {
        TransferManager tm = TransferManagerBuilder.standard()
        // TransferManager processes all transfers asynchronously,
        // so this call returns immediately.
        Upload upload = tm.upload(bucketName, key, new File(filePath));
        System.out.println("Object upload started");
        // Optionally, wait for the upload to finish before continuing.
        System.out.println("Object upload complete");
    }catch( Exception ex){

The parameters are derived from previous steps:

  • The bucketName can be extracted from the the initial section of the decoded s3Path. If the s3Path is rms-mi/preview/tenant/50000/import/mri/3929, the bucketName is "rms-mi".
  • The key combines the remaining portion of the s3Path with the fileId, fileName in the following pattern: s3Path/fileId-fileName. For example, "preview/tenant/50000/import/mri/3929/12373-fileName".
  • The filePath specifies the absolute path to flat file you want to upload.

Next steps

You can upload reinsurance data.

Did this page help you?