Forum Discussion

HoneyGulati's avatar
HoneyGulati
New Contributor III
8 months ago

Push file from OS Export to AWS S3 folder via business rule

Hi,

Can anyone guide me to push the file from OS export folder to AWS S3 bucket via business rule?

Currently it is being taken care by power script. Wondering if it can be achieved by business rule?

  • hbindu's avatar
    hbindu
    New Contributor III

    Hi,

    I wrote an extensibility BR to extract data from OS to a csv file and the file is then moved to an FTP folder. 

    In your case instead of FTP folder it will be AWS S3 bucket. 

    below is the sample code:

    If filecount > 0  Then 
    Dim sessionOptions As New SessionOptions
    Dim transferOptions As New TransferOptions
    Dim transferResult As TransferOperationResult
    Using session As New Session
    session.Open(sessionOptions)
    transferOptions.TransferMode = TransferMode.Binary
    transferOptions.OverwriteMode = OverwriteMode.Overwrite
    'transferOptions.PreserveTimeStamp = True
    transferOptions.ResumeSupport.State = TransferResumeSupportState.Off
    Dim RootFolder As String = $"{session.HomePath}/<RootFolderpath>"
      files = From chkFile In Directory.EnumerateFiles(_path, "*.PGP", SearchOption.TopDirectoryOnly)
    For Each Filepath In files
    transferResult = session.PutFiles($"{Filepath}", RootFolder, False, transferOptions)
    transferResult.Check()
    Next
    Using 
    End If

     

     

  • Krishna's avatar
    Krishna
    Valued Contributor

    HoneyGulati  - Yes you can get the Data from S3 Bucket. 

    1. AWS Side - Make sure you have proper access key & security defined in AWS console for S3. Verify you were able to connect to S3 with the access.

    2. Configure SIC for the S3.

    3. Create a Extender BR to orchestrate the data between S3 & OS. 

     

    Hope this helps.