Follow the steps below to create a Sync Gateway instance running under AWS with the following architecture:
It will be using the Walrus in-memory database, and so it is only useful for light testing. Walrus does have the abiity to snapshot its memory contents to a file, so your data can persist across restarts.
Warning: don’t run this in production! If you want something that is closer to production ready, check out Running a Sync Gateway Cluster Under CoreOS on AWS instead.
Launch EC2 instance
Go to the Cloudformation Wizard
- ClusterSize: 1 node
- Discovery URL: as it says, you need to grab a new token from https://discovery.etcd.io/new and paste it in the box.
- KeyPair: the name of the AWS keypair you want to use.
For the keypair that you use, your local ssh client will need to have the private key side of that keypair.
Wait until instances are up
Hit the “reload” button until it goes to the CREATE_COMPLETE state.
Find ip of instance
Go to the AWS console under the “EC2 instances” section and find the public ip of one of your newly launched CoreOS instances.
Choose any one of them (it doesn’t matter which), and look for the Public IP. Copy that value onto your clipboard.
SSH into instance
ssh into it as the core user with the cert provided in the previous step:
Create a volume directory
After you ssh into your instance, create a volume directory so that the data persists across different container instances.
Launch Sync Gateway
You should see the following output:
1 2 3 4 5 6 7
Congratulations! You now have a Sync Gateway running.
It might feel underwhelming, because nothing appears to be happening, but sync gateway is actually running in the background. To verify that, run:
1 2 3
Verify Sync Gateway
Assuming your public ip is
http://18.104.22.168:4984 into your web browser and you should see:
1 2 3 4 5 6 7 8
To make sure the database was configured correctly, change the url to
http://22.214.171.124:4984/db, and you should see:
1 2 3 4
Try out document API via curl
Create a new document
This will return the following JSON:
1 2 3 4 5
View the document
Using the doc id returned above:
You should see:
1 2 3 4 5
Check out the Sync Gateway REST API docs for full documentation on the available REST calls you can make.
Restart Sync Gateway with new config
If you need to change your sync gateway config, follow the instructions below.
Stop and remove existing container
Find the container id via
sudo docker ps as shown above, and run this command with your own container id:
Update sync gateway config
You can take this sample config and customize it to your needs, and then upload it somewhere on the web.
Make sure you keep the
server field as
"walrus:data", since that tells Sync Gateway to use walrus and to store the data in the
Start container with new config
After it starts up, your sync gateway will be running with the new config.
Next step: try out the GrocerySync app
Choose the GrocerySync app for your platform:
and point the sync url at your server instead of the default. Now should be able to sync data through your own Sync Gateway.
If you are on Phonegap, check our sample apps listing which has a link to the TodoLite-Phonegap app.