# AWS S3 Storage

If you have the yCrash server application installed across multiple server nodes behind a load balancer then it's mandatory to store the uploaded files in some common storage solutions like AWS S3.

By default, uploaded files are stored on the local disk of the machine where the yCrash server application is running. However, the tool also provides the option to store uploaded files in S3. Some customers may prefer not to store files locally due to space limitations or concerns about availability. If you have the yCrash server installed across multiple instances behind a load balancer, it is essential to store uploaded files in AWS S3. This ensures that users can access generated reports regardless of the server instance handling their request. For example, if a user uploads a file to server node-1 and another user attempts to access the same report, the load balancer may route the request to server node-2. If the files are stored locally, the second user may encounter an HTTP 404 error. This setup will ensure that uploaded files are stored in AWS S3, enabling seamless access across all server instances.

Follow these steps to store uploaded files in AWS S3:

# 1. Specify AWS S3 credentials to yCrash:

Download (opens new window) the provided template file or create a new XML file named storage.xml and place it in the uploadDir directory of yCrash server. This file specifies "s3 bucket name", "access key", "secrete key" information as shown in the below format:

Here's a XML template file with placeholders:





 
 
 
 
 


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
<properties>
    <comment>Storage Configurations</comment>	
    <entry key="s3.endPointURL">https://s3.YOUR_REGION.amazonaws.com</entry>
    <entry key="s3.region">YOUR_REGION</entry>
    <entry key="s3.bucketName">YOUR_BUCKET_NAME</entry>
    <entry key="s3.accessKey">YOUR_ACCESS_KEY</entry>
    <entry key="s3.secreteKey">YOUR_SECRETE_KEY</entry>
</properties>
1
2
3
4
5
6
7
8
9
10

In this template:

  • Replace "YOUR_REGION" with the AWS region where your S3 bucket is located (e.g., "us-west-1").
  • Replace "YOUR_BUCKET_NAME" with the name of your S3 bucket.
  • Replace "YOUR_ACCESS_KEY" and "YOUR_SECRETE_KEY" with your AWS access key and secrete key, respectively.

Here’s a sample S3 XML file:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
<properties>
    <comment>Storage Configurations</comment>	
    <entry key="s3.endPointURL">https://s3.us-west-1.amazonaws.com</entry>
    <entry key="s3.region">us-west-1</entry>
    <entry key="s3.bucketName">my-bucket</entry>
    <entry key="s3.accessKey">my-access-key</entry>
    <entry key="s3.secreteKey">my-secrete-key</entry>
</properties>
1
2
3
4
5
6
7
8
9
10

# 2. Configure CORS in AWS S3 Bucket:

Please follow the below steps to configure CORS in your S3 bucket -

  • Sign in to the AWS Management Console.

  • In the Buckets list, choose the name of the bucket where you want to configure the CORS.

  • Next choose the Permissions tab.

  • In the Cross-origin resource sharing (CORS) section, click on Edit.

  • In the CORS configuration editor text box, type or copy and paste a new CORS configuration, or edit an existing configuration.

The text that you type in the editor must be a valid JSON. Here is a sample CORS JSON. You may want to change the values based on your requirements.

[
    {
        "AllowedHeaders": ["*"],
        "AllowedMethods": ["GET","POST","PUT"],
        "AllowedOrigins": ["http://www.example1.com"],
        "ExposeHeaders": [],
        "MaxAgeSeconds": 3000
    }
]
1
2
3
4
5
6
7
8
9

You can find more examples in the AWS documentation - https://docs.aws.amazon.com/AmazonS3/latest/userguide/ManageCorsUsing.html (opens new window)

# 3. Restart the Application:

Restart the yCrash server application to apply the changes.


Note: All configuration files, including license.lic, *.xml, and *.json related to yCrash server settings, will continue to remain and be maintained in the uploadDir path.