# 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 the Astera Data Stack. 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 in Astera 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://750977703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqHxyVNGb7tSdIWecl6Ru%2Fuploads%2FxDTtywJeGj9dierqEe30%2F0.png?alt=media)

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

![](https://750977703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqHxyVNGb7tSdIWecl6Ru%2Fuploads%2FmePWNGqpXryW2Y0aMExk%2F1.png?alt=media)

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

![](https://750977703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqHxyVNGb7tSdIWecl6Ru%2Fuploads%2FnygAP0L6ltIxjf726gQn%2F2.png?alt=media)

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

![](https://750977703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqHxyVNGb7tSdIWecl6Ru%2Fuploads%2FQIMMLM8Yv6xmPj4UCisE%2F3.png?alt=media)

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://750977703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqHxyVNGb7tSdIWecl6Ru%2Fuploads%2FhKZ8NTA7WIgROATi8eMI%2F4.png?alt=media)

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

![](https://750977703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqHxyVNGb7tSdIWecl6Ru%2Fuploads%2F9OruvV0rRR4RtbQKtw50%2F5.png?alt=media)

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://750977703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqHxyVNGb7tSdIWecl6Ru%2Fuploads%2FfP7TyuycmKga2ZjuJdX4%2F6.png?alt=media)

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

![](https://750977703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqHxyVNGb7tSdIWecl6Ru%2Fuploads%2FuWaKOHH0dFJLuObVPGLc%2F7.png?alt=media)

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://750977703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqHxyVNGb7tSdIWecl6Ru%2Fuploads%2FV5nYfahF5nJP75lcnrBV%2F8.png?alt=media)

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://750977703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqHxyVNGb7tSdIWecl6Ru%2Fuploads%2FsVM1N5E90EgOc7swc6Uk%2F9.png?alt=media)

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

![](https://750977703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqHxyVNGb7tSdIWecl6Ru%2Fuploads%2FbTdUcCzBel7QeRtQddYI%2F10.png?alt=media)

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

![](https://750977703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqHxyVNGb7tSdIWecl6Ru%2Fuploads%2FryIuCKREfXKENCFtIc3X%2F11.png?alt=media)

{% 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 on. 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://750977703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqHxyVNGb7tSdIWecl6Ru%2Fuploads%2FmNUIdnsQinAg3HllfoKG%2F12.png?alt=media)

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://750977703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqHxyVNGb7tSdIWecl6Ru%2Fuploads%2FviKXRyeJSOBRGfYwihes%2F13.png?alt=media)

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

![](https://750977703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqHxyVNGb7tSdIWecl6Ru%2Fuploads%2FPmQ5tVnQkMnbYnrFoyee%2F14.png?alt=media)

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

![](https://750977703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqHxyVNGb7tSdIWecl6Ru%2Fuploads%2FfDbZlyWrU5EdnOOoKo0d%2F15.png?alt=media)

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

![](https://750977703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqHxyVNGb7tSdIWecl6Ru%2Fuploads%2F8WKb8syoIbUkp2OB3wwL%2F16.png?alt=media)

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

![](https://750977703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqHxyVNGb7tSdIWecl6Ru%2Fuploads%2F5oyouYDHQp0zUPjP4GF9%2F17.png?alt=media)

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

![](https://750977703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqHxyVNGb7tSdIWecl6Ru%2Fuploads%2FwBUTximIGRzKQHZFcpPb%2F18.png?alt=media)

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

![](https://750977703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqHxyVNGb7tSdIWecl6Ru%2Fuploads%2Fu76Ss2RCVUIyR6HWoQUz%2F19.png?alt=media)

## **Exporting Data to a Cloud Destination**

Here is how we can export our extracted data to an [Excel](https://documentation.astera.com/v/astera-data-stack-v8/dataflows/destinations/excel-workbook-destination) or a [Delimited](https://documentation.astera.com/v/astera-data-stack-v8/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://750977703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqHxyVNGb7tSdIWecl6Ru%2Fuploads%2F0lVSEKmAz0S5gDG7A1We%2F20.png?alt=media)

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

<figure><img src="https://750977703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqHxyVNGb7tSdIWecl6Ru%2Fuploads%2FIGKq7pipoydBjIaI5b2m%2Fimage.png?alt=media&#x26;token=c1c57b10-52a1-495b-b2c9-0de89e07d401" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://750977703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqHxyVNGb7tSdIWecl6Ru%2Fuploads%2FEPdUWAJnVJgEvvUh6Zfc%2Fimage.png?alt=media&#x26;token=a807f8b1-648f-45ca-b820-448e9f2f75e5" alt=""><figcaption></figcaption></figure>

4. The *File Path* is now pointing towards the Amazon S3 cloud provider. Click *OK.*

<figure><img src="https://750977703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqHxyVNGb7tSdIWecl6Ru%2Fuploads%2FBdsOb6P38JQny8JVRJYj%2Fimage.png?alt=media&#x26;token=27bd814d-fd77-477c-bc42-207736f91080" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://750977703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqHxyVNGb7tSdIWecl6Ru%2Fuploads%2FF7rNCphpCEVpUMqVNhrJ%2Fimage.png?alt=media&#x26;token=cf41f0dd-7fde-4b7a-8edf-c23b9f5850fb" alt=""><figcaption></figcaption></figure>

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.

<figure><img src="https://750977703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqHxyVNGb7tSdIWecl6Ru%2Fuploads%2FGk9c159tDeKcXqjARrHy%2Fimage.png?alt=media&#x26;token=ca404944-8d75-4c69-9126-e8cf4c0a75f6" alt=""><figcaption></figcaption></figure>

## **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.

<figure><img src="https://750977703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqHxyVNGb7tSdIWecl6Ru%2Fuploads%2FwYCUqb1Hwb493L9CgB51%2Fimage.png?alt=media&#x26;token=f2dfe80b-2f20-4c77-846d-50c73688bb35" alt=""><figcaption></figcaption></figure>

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.

<figure><img src="https://750977703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqHxyVNGb7tSdIWecl6Ru%2Fuploads%2FrfOzDoSFKnSQdWM7VjcD%2Fimage.png?alt=media&#x26;token=c1a8a549-9287-48b7-8faa-c86cdcd1e72c" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://750977703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqHxyVNGb7tSdIWecl6Ru%2Fuploads%2F47oOGl6vQ8gVjIRaF6DC%2Fimage.png?alt=media&#x26;token=7cf54f29-b525-4493-9b65-46dba8dbd9a4" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://750977703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqHxyVNGb7tSdIWecl6Ru%2Fuploads%2FFdrvs5INyNT7Rm8TZgp9%2Fimage.png?alt=media&#x26;token=4f1eab57-52a5-417a-ae47-bf1e1a61b43b" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://750977703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqHxyVNGb7tSdIWecl6Ru%2Fuploads%2F9Ovpf7MjSTeMO65ZqJjp%2Fimage.png?alt=media&#x26;token=a1aabec3-fa4f-4486-8cd8-258a294c68ec" alt=""><figcaption></figcaption></figure>

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 %}

<figure><img src="https://750977703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqHxyVNGb7tSdIWecl6Ru%2Fuploads%2FFUecGSb16eTlXmxT5yTl%2Fimage.png?alt=media&#x26;token=89d78634-81d8-431a-9484-b42fa2d80d7f" alt=""><figcaption></figcaption></figure>

6. Click *OK* to close the window.

<figure><img src="https://750977703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqHxyVNGb7tSdIWecl6Ru%2Fuploads%2FUZi7RZxo97W6F4WylUm4%2Fimage.png?alt=media&#x26;token=18d70267-7327-4e6a-8ea8-d858b3f42d46" alt=""><figcaption></figcaption></figure>

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.*

<figure><img src="https://750977703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqHxyVNGb7tSdIWecl6Ru%2Fuploads%2F6byQeQbQtiREdrNIqV9M%2Fimage.png?alt=media&#x26;token=87d04cc4-bca2-4957-8838-77d12e8a87a9" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://750977703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqHxyVNGb7tSdIWecl6Ru%2Fuploads%2Fzh2wzTpVc1hbVR9SHPmi%2Fimage.png?alt=media&#x26;token=d03ec119-57be-43a4-8b32-d21bebd2cede" alt=""><figcaption></figcaption></figure>

## **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.

<figure><img src="https://750977703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqHxyVNGb7tSdIWecl6Ru%2Fuploads%2FCRw8ndFIeU7UfFZjHSkd%2Fimage.png?alt=media&#x26;token=ef035cad-6baa-4881-898c-4fa67a697157" alt=""><figcaption></figcaption></figure>

### **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/v/astera-data-stack-v8/dataflows/destinations/excel-workbook-destination) (in a dataflow).

We will do this by using the [*Report Source as a Transformation*](https://documentation.astera.com/v/astera-data-stack-v8/dataflows/transformations/sources-as-transformations#report-source-as-a-transformation) in a [dataflow ](https://documentation.astera.com/v/astera-data-stack-v8/use-cases/end-to-end-use-cases/data-extraction/reusing-the-extraction-template-for-similar-layout-files#creating-a-dataflow)where we can [parametrize ](https://documentation.astera.com/v/astera-data-stack-v8/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:

<figure><img src="https://750977703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqHxyVNGb7tSdIWecl6Ru%2Fuploads%2F9Xyp9EgmGY9uxgaC3BFp%2Fimage.png?alt=media&#x26;token=5581f0be-ae34-44cb-9040-071ba917027f" alt=""><figcaption></figcaption></figure>

Then, we will call the dataflow in a[ workflow](https://documentation.astera.com/v/astera-data-stack-v8/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:

<figure><img src="https://750977703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqHxyVNGb7tSdIWecl6Ru%2Fuploads%2Fx6nXXqLuWYcM3bwI3MHx%2Fimage.png?alt=media&#x26;token=2c676e07-a3aa-4f56-be31-e5203908f969" alt=""><figcaption></figcaption></figure>

## **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.

<figure><img src="https://750977703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqHxyVNGb7tSdIWecl6Ru%2Fuploads%2Ftd76JKOFJjEGP6hCKr97%2Fimage.png?alt=media&#x26;token=96bafa37-1cc7-43c6-8b53-4e38520efe72" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://750977703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqHxyVNGb7tSdIWecl6Ru%2Fuploads%2FHseQFGTk6oXD0bEJrcc1%2Fimage.png?alt=media&#x26;token=1b6025cc-a0de-4b8b-9dd2-302d1a555b6f" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://750977703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqHxyVNGb7tSdIWecl6Ru%2Fuploads%2FLtePrMYfYuq9DZB5sQGH%2Fimage.png?alt=media&#x26;token=b976eebb-f60b-442d-b4bf-1af15269f54f" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://750977703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqHxyVNGb7tSdIWecl6Ru%2Fuploads%2FjeAjefo9CgPYf2CenH7C%2Fimage.png?alt=media&#x26;token=be16d83c-5bdd-41db-8de7-0641dbfff16f" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://750977703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqHxyVNGb7tSdIWecl6Ru%2Fuploads%2F6cFzJyGhTiYWM9CscgVN%2Fimage.png?alt=media&#x26;token=3fb15234-b710-4075-bb09-30bd8189febb" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://750977703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqHxyVNGb7tSdIWecl6Ru%2Fuploads%2FHwLfb1w9l0VlU1CLUrcO%2Fimage.png?alt=media&#x26;token=a4cab7fd-e702-4675-b243-d553647df528" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://750977703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqHxyVNGb7tSdIWecl6Ru%2Fuploads%2FpuEYFrxoVEZubm312XKc%2Fimage.png?alt=media&#x26;token=ad1953de-225b-4c0e-9fbb-195d7190608d" alt=""><figcaption></figcaption></figure>

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