1 Reply Latest reply on Feb 11, 2019 2:14 PM by Patrick Van Der Hyde

    Store files to S3 using Powershell and CLI

    Dave Yorkshire

      Below is my code. as of now is it sending it to a file on the network.  Id like to send backup data to my S3 bucket.   Has anyone done this without using the AWS plug-in and able to do it in powershell just using CLI. (not aws for powershell)  I see documentation in AWS, but it is vague concerning Tableau.  Any help or pointers would be great,.   I am new to Tableau and Powershell.

      What I tried to do was take the backup path and move it to aws s3 bucket.


      So the command..

      aws s3 cp "G: (serverback up path\tab.server.tsbak)"+$DateStamp s3://bucketname/filename

      did not work





      tabadmin stop


      tabadmin ziplogs -p -a -f -l -n

      #begins process to add all the log files to a zip file


      tabadmin cleanup

      #cleans up srver logs and temp directories


      tabadmin start


      tabadmin cleanup

      #running cleanup with the services running will clean up different items that are unreachable when the services are stopped


      tabadmin backup G:\documentation\backups\tableau.tsbak -d

      #begins the server backup and adds a timestamp to the file name


      copy F:\windows\sys\logs.zip  G:\Documentation\Backups\logs.zip

      #copies the log zip file from the working directory to the archive directory


      $DateStamp = get-date -uformat "%Y-%m-%d"

      #creates a variable containing the current date


      rename-item G:\Documentation\Log_Backups\logs.zip G:\Documentation\Backups\logs-$DateStamp.zip

      #renames the log zip file to add the datestamp


      del G:\Documentation\Backups\logs.zip

      #deletes file from working directory


      #Clean up old files

      $limit = (Get-Date).AddDays(-30)

      $Path = "G:\Documentation\backups\"


      #Delete files older than the $limit

      Get-Children -Path $path2 -Recurse -Force | Where-Object { !$_.PSIsContainer -and $_.CreationTime -lt $limit -and $_.Name.EndsWith("tsbak" }


      $output = (tabadmin status) | out-string

      #runs tabadmin status to get the server status, then converts the output to a string and stores it in a variable