# Connecting to Cloud Storage

In this article, we will see how a user can create a shared connection to access and store files from and to the cloud in Astera. To browse cloud files in a report model, the report model should be a part of a project containing the *Shared Action Connection*.

{% hint style="info" %}
**Note:** This feature of browsing files from the cloud only works if the user has the Cloud Connector add-on.
{% endhint %}

### Creating a New Cloud Connection

To create a new cloud connection in a project, you need to add a shared connection within the scope of that project. Once that is done, you can browse for cloud files from the *Report Options* panel in a report model that is present within the same project.

#### Adding a Shared Connection in a Project

1. To add a shared connection, we need to create a new project first. Here, we have named our project *RMCloud.cprj.*

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/sV8IMHxPpcLhMOByqo0d/01-project.png)

2. Next, create a folder, *Shared Connections,* inside the project. We will save our shared connections (*.sact* files) in this folder.

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/h5AbJvHqNhErILf8sMgt/02-folder.png)

3. Right-click on the folder, and select *Add New Item…*

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/J6oLdo6mfxosUYDnLqV4/03-add-new-item.png)

4. Select *SharedAction* from the list of file types, give it a meaningful name, and click *Add.*

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/D7PT94hGGGM5jaL33840/04-shared-action.png)

5. A *.sact* file will open. We have saved it with the name *SharedAction.sact*.

Go to *Toolbox > Resources* and drag-and-drop the *Cloud Storage Connection* object onto the designer.

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/Iy8yneBz8AIBTKGVyouJ/05-cloud-storage-connection.png)

6. Right-click on the header of the object and select *Properties.*

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/TFxhNuNASXzHwjXJ7aXF/06-properties.png)

7. A *Cloud Connection Properties* window will open, where you can configure your *Cloud Connection* object by providing appropriate credentials. Select the *Provider* from the drop-down menu. In this case, we will select *Amazon S3.*

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/GmcJYHYxXiAqRx62ewDY/08-provider.png)

8. Provide appropriate credentials, *Access Key ID* and *Access Key.* Click *OK.*

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/RosZfMCMNv2S2TxIcMLQ/09-credentials.png)

Your *SharedAction.sact* is now configured. You can access files from this cloud connection in the project.

#### Adding a Shared Connection via Report Options

1. To create a new cloud connection through *Report Options,* we need to create/add a report model within our project first.

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/vlPtodBAlCfQlAksMNay/10-report-model.png)

2. Open the report model. Go to the *Report Options* panel, and click on the arrow next to the folder icon in the *Data File Location* group-box. Select the *Browse Cloud Files* option.

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/0wv4S7YdiQT3xawputk4/11-browse-cloud-files.png)

3. A *Browse Files* window will open. We can see the Amazon S3 *SharedAction* connection we created above in this window.

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/hm9VnlT2nyaV7c59Ge4l/12-browse-files.png)

4. Click on the *Add New Connection* icon.

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/nUWbkXrJR6ILweinGiu5/13-add-new-connection.png)

{% hint style="info" %}
**Note**: This is an alternative way for you to add a shared action (shared cloud connection) to the project you are working in. If you have already created a shared action for the cloud connection you want to use in your project, there is no need to add a new connection.
{% endhint %}

5. A window to *Add a Cloud Connection* will open.

Here, we will select *Microsoft Azure Blob Storage* as our *Provider*.

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/zmYuWSiAJxDjqHZRV2NY/15-add-azure.PNG)

6. There are two ways to authenticate the connection, using an *Access Key* or through *Shared Access Signature.* For now, we will use the *Access Key.*

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/wHtcsA8Yyz5vktuyhI1I/16-access-key.png)

7. Provide relevant credentials by specifying the *Storage Account Name* and *Access Key.* Click *OK.*

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/RUsuBR9uYjXJxYbtdEhg/17-authentication.png)

8. The newly created connection is now a part of the project.

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/SuRMIlUBS25BpDMyKG9F/18-connection.png)

9. Select the file you want to extract data from from the cloud connection and click *Open*.

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/EyIC49fvnklCxR6iyMUd/41-cloud-file.png)

10. Create a data region and relevant fields in the report model to extract relevant data from the source file.

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/gOlJBTk10ag44iSLSDhf/report-browser.png)

11. Click on *Preview Data* to see if the report model is extracting data from the specified fields correctly.

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/NslwW6TirNIE1yVlMAI0/42-preview-output.png)

12. The *Data Preview* window shows the data extracted from the file located on the cloud.

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/IiyOE0dxeZtFAY3hXdf9/43-data-preview.PNG)

### Exporting Data to a Cloud Destination

Here is how we can export our extracted data to an [Excel ](https://documentation.astera.com/dataflows/destinations/excel-workbook-destination)or a [Delimited ](https://documentation.astera.com/dataflows/destinations/delimited-file-destination)file and save it on the cloud destination.

1. Go to *Report Browser > Data Export Settings* and select *Create New Export Setting and Run (to Excel)* option.

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/ftDDRRfxngdv0fkC95x1/19-export-to-excel.png)

2. A configuration window will open. Click on the arrow next to the folder icon and select *Browse Cloud Files* option.

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/y9qiCt3rdKHE5dfMuE98/20-browse-cloud.png)

3. Locate the cloud directory where you want to save the Excel file, give it a meaningful name, and click *Open.*

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/49moKZKmUVZJDpIo16vD/21-save-excel.png)

4. The file path is now pointing towards the Amazon S3 cloud provider. Click *OK.*

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/7qV8cRlIGTOsIWlemCzV/22-click-ok.png)

5. The *Job Progress* window shows the job status and the cloud path where the destination file has been created.

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/cooJpifgs7xK6OuJPbNl/23-2-dest.png)

6. If you want to create a *Delimited File Destination*, click on this icon in the *Data Export Settings* window and follow the same steps (step 2 onwards) as mentioned above.

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/5OA2zYSyt95524gJae2s/24-create-delimited.png)

### Using Files from the Cloud in a Dataflow

We can access files from the cloud in a dataflow using the *Report Source* object. For that, the dataflow must be a part of the project or must contain a *Cloud Storage Connection* object pointing to the cloud location.

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/MxElZQKk380OLMORHw0v/25-dataflow.png)

In this case, we will extract data from a file saved on a cloud location using a report model from the local directory.

1. Go to *Toolbox > Sources* and drag-and-drop the *Report Source* object onto the designer.

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/Apod2NmrSpWuvdAlENIp/26-report-source.png)

2. Right-click on top of the *Report Model* object header and select *Properties* from the menu.

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/gtLBYgCQlCD1mbhxjFiG/27-report-properties.png)

3. Click on the arrow button next to the folder icon in the *Report Location* group-box to browse files from the cloud.

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/Gs7VbMqsbrO9luRP8hnc/28-browse-cloud.png)

4. Locate the file in cloud directory and click *OK.*

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/gRLMOa2yLyLgYDPmbUxy/29-locate-file.png)

5. The *File Path* is now pointing towards the Amazon S3 cloud provider. Click on the folder icon to browse the report model from your local directory.

{% hint style="info" %}
**Note**: The report model must be a part of your project.
{% endhint %}

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/TpBw01U6a9P5Nszuy57Y/30-folder.png)

6. Click *OK* to close the window.

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/OjZf16QwbmW23dc9Y68Y/31-ok.png)

7. The *Report Source* object is now configured with a file path coming in from the Amazon S3 cloud connection and the report model from the local directory.

Right-click on the header and select *Preview Output.*

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/5LZwDcPhBFzAGntH2nxp/32-preview.png)

8. The *Data Preview* window shows that the file is correctly being read by the report model.

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/HhZ1WSneVxuOE4OIW3A3/33-data-preview.PNG)

### Using Files from the Cloud in a Workflow

We can access files from the cloud in a workflow as well, using the *File System* object. For that, the workflow must be a part of the same project as your shared connection.

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/dScg5AeBCeLPNF4JnYST/34-workflow.png)

#### Use-Case

In this case, we want to read all the files from a particular cloud directory (in a workflow) and extract data from those files to write it in an [*Excel Workbook Destination* ](https://documentation.astera.com/dataflows/destinations/excel-workbook-destination)(in a dataflow).

We will do this by using the [*Report Source as a Transformation* ](https://documentation.astera.com/dataflows/transformations/sources-as-transformations#report-source-as-a-transformation)in a [dataflow ](https://documentation.astera.com/use-cases/end-to-end-use-cases/data-extraction/reusing-the-extraction-template-for-similar-layout-files)where we can [parametrize](https://documentation.astera.com/use-cases/end-to-end-use-cases/data-extraction/reusing-the-extraction-template-for-similar-layout-files#parameterizing-the-dataflow) the path of the file we want to extract data from using the *Variables* object. This is what the dataflow will look like:

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/mfXQkirHTtWysy7msRhu/01-dataflow.PNG)

Then, we will call the dataflow in a [workflow ](https://documentation.astera.com/use-cases/end-to-end-use-cases/data-extraction/reusing-the-extraction-template-for-similar-layout-files#designing-a-workflow)using a *Run Dataflow* object and read the files from the cloud using a *File System Items Source* in a loop. We will send the cloud file path of the source file to the *File Path* variable in the dataflow as shown below.

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/KERpeHSzJXH9Bylme3Ly/02-workflow.PNG)

#### Using File System Items Source to Browse Cloud Files

1. Go to *Toolbox > Sources* and drag-and-drop the *File System Items Source* object onto the designer.

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/WvhlSo1C6Kq4HO6A4tam/03-source.png)

2. Right-click on the object header and select *Properties.*

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/UV5xFzm9XJW7S57uhFJQ/04-properties.png)

3. Click on *Browse Cloud Folders* to access the cloud folder from where you want to read files.

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/H8Pj9U8kXEa5HesX2bs8/05-browse-cloud.png)

4. Here, we have selected the folder containing the source files from our Amazon S3 cloud connection. Click *Open.*

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/yduLM0DRE66cuLWHJND1/06-cloud-folder.png)

5. Our *File Path* is now pointing towards a cloud file path. Click *OK.*

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/eIEhdh0HHB5SoUpXjkst/07-click-ok.png)

6. Our workflow is now complete. Click on *Start Workflow* to run the workflow.

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/imRPh6kXH32EUfsnk0gq/08-start-workflow.png)

7. The *Job Progress* window shows the status of the job and the path of the Excel destination.

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/VedoCpyue8pfcutIx5s9/09-job-progress.png)

This is how you can create cloud connections and browse files from the cloud in Astera.
