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 queuesqspaste
- get the queue contents and then place it onto the system clipboardsqspurge
- remove all entries from the queuesqscopysmallfile
- 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 astandard
queue -
- The name of your queue should end in
.fifo
- The name of your queue should end in
- Set the
Receive message wait time
aka long polling to at least12
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
- Data key reuse period:
-
- 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
- Please review these scripts before running them and make any adjustments as needed:
- Both of these scripts use cloud_formation_template.json
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 SQSFIFO
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
- Windows:
-
- MacOS:
${HOME}/.aws/sqs_clipboard
- MacOS:
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
Cross Platform
- a cross platform Go library to place an icon and menu in the notification area
Windows
- How do you set the application icon in golang?
Mac
- Packaging a Go application for macOS
AWS Resources