sqs_clipboard

Use AWS SQS as a clipboard to copy and paste across different systems and platforms. Clipboard contents are encrypted in transit and at rest.

Binaries for Windows, MacOS, and Linux can be found on the Releases Page.


Description

This set of programs can be used to copy and paste clipboard text by using an AWS SQS FIFO Queue as an intermediary. To minimize the amount of data transferred, the contents are compressed with the XZ algorithm before sending to the SQS queue via sqscopy and then decompressed upon arrival via sqspaste. A maximum of 256 KB of compressed (and then encoded) data can be sent to the queue.

NOTE: There can be a small AWS cost when using this program. Each copy / paste operation uses 3 SQS requests, plus the data transferred associated with sqspaste and sqspastesmallfile. See Amazon SQS pricing for more details.

Programs

  • sqscopy – send the system clipboard contents to a user-defined AWS SQS FIFO queue
  • sqspaste – get the queue contents and then place it onto the system clipboard
  • sqspurge – remove all entries from the queue
  • sqscopysmallfile – copy a small file to the queue with file name given on command line
    • after XZ compression and base 91 encoding, the resulting file size must be less than 256 KB
  • sqspastesmallfile – retrieve a file from the queue
    • will overwrite an existing file with the same name
    • file name is stored in the queue along with the file
    • no command line arguments needed

AWS Queue Creation

  • Open the Amazon SQS Console
  • Make sure to create a fifo queue instead of a standard queue
    • The name of your queue should end in .fifo
  • Set the Receive message wait time aka long polling to at least 12 seconds
  • Note: Do not check: Content-based deduplication, otherwise you will not be able to copy the exact same contents with a 5 minute interval.
  • Send / Receive Access: Only the queue owner
  • Encryption: Optional, but recommended
    • Data key reuse period: 1 hour
    • A shorter time period provides better security, but results in more calls to AWS KMS, which might incur charges after Free Tier.

AWS Queue Creation – Automation

AWS IAM Permissions

  • Make sure to change the Resource value listed below.

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "VisualEditor0",
            "Effect": "Allow",
            "Action": [
                "sqs:DeleteMessage",
                "sqs:GetQueueUrl",
                "sqs:ChangeMessageVisibility",
                "sqs:PurgeQueue",
                "sqs:ReceiveMessage",
                "sqs:DeleteQueue",
                "sqs:SendMessage",
                "sqs:GetQueueAttributes",
                "sqs:ListQueueTags",
                "sqs:CreateQueue" 
            ],
            "Resource": "arn:aws:sqs:region:account-id:QueueName.fifo"
        }
    ]
}

Setting Environment Variables

  • The SQS_CLIPBOARD_URL environment variable should be set to URL of your SQS FIFO Queue
    • This URL can be found on the AWS SQS Dashboard for the queue that you have created
  • How to set environment variables

Setting Configuration File

  • For Windows and MacOS, you might want to set the SQS_CLIPBOARD_URL value in a configuration file instead of using environment variable.
  • This will allow you to launch the programs from the Windows Taskbar or MacOS Dock.
  • To do this you will need to create this file:
    • Windows: %HOMEPATH%\.aws\sqs_clipboard
    • MacOS: ${HOME}/.aws/sqs_clipboard

File format:

[default]
SQS_CLIPBOARD_URL=https://sqs.region.amazonaws.com/account-id/queuename.fifo

Compilation

  • Install GoReleaser
  • Run: goreleaser build --rm-dist --snapshot
  • There should now be 5 resulting binaries found in the dist directory:
    • sqscopy
    • sqspaste
    • sqspurge
    • sqscopysmallfile
    • sqspastesmallfile

You can also create a Mac App by running mac_app_builder.sh


Windows Icons Used

Bundling Icons

AWS Resources

GitHub

https://github.com/jftuga/sqs_clipboard