-
-
Save jyotirmoy-blockchain-dev/26f51327eb7f463bf34f24ef45f7bb56 to your computer and use it in GitHub Desktop.
Using AWS with the Pre-built Sawtooth Supply Chain Instance
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Using AWS with the Pre-built Sawtooth Supply Chain Instance | |
By Dan Anderson (February 1, 2019) | |
These instructions create an "Free Tier" AWS instance running Sawtooth Marketplace on Sawtooth 0.8.9. | |
The instance is pre-release and old (2017) (the current Sawtooth release, December 2018, is 1.1) | |
1. Go to AWS Marketplace "Hyperledget Sawtooth Supply Chain" at | |
https://aws.amazon.com/marketplace/pp/B077FLR7V5 | |
2. Click "Sign in or Create a new account" in the upper right | |
3. You'll probably want to use the "Free Tier". | |
To qualify use a t2.micro instance (1GByte memory) no more than 750 hours a month for up to 1 year. | |
It's good practice to stop your instance when you are not using it after a day or two | |
(to avoid using your 750 hours) and to destroy your instance when you are finished | |
4. Pick a region close to you. I set the region "US West (Oregon)" | |
5. Leave your "Fulfillment Option" as "64-bit (x86) Amazon Machine image (AMI)" (my only choice!) | |
6. Pick your EC2 Instance type (size) as "t2.micro" in the table "Hyperledger Sawtooth Supply Chain". If you pick "t2.small" or larger, it will not qualify as an AWS Free Tier. "t2.nano" (also free) may work, but I haven't tried it | |
7. Click the orange "Continue to Subscribe" in the upper right | |
8. Click the orange "Accept Terms". Bonus points if you read the AWS Customer Agreement :-) | |
9. You should see a webpage with spinning circle and "Pending" for "Effective Date" | |
10. When the instance is available, the "Effective Date" changes to today with no expiration | |
11. Click on the orange "Continue to Configuration" in the upper right | |
12. Pick your closest Region. I selected "US West (Oregon)". | |
13. You will be taken to the Hyperledger Sawtooth Supply Chain webpage with an oversized banner | |
14. Leave Fullfillment Option (64-bit x86 AMI) and Version (0.3.0) unchanged (my only choice!) | |
15. In the upper right click on the blue "Continue to Launch" | |
16. You will be taken to a "Launch this software" page. | |
17. Leave "Choose Action" as "Launch from Website". | |
18. Change EC2 Instance Type" to "t2.micro" (which qualifies for the AWS Free Tier) | |
19. Leave "VPC Settings" and "Subnet Settings" unchanged | |
20. For "Security Group Settings" click "New based on Seller Settings". | |
21. You should see SSH and HTTP allowed from anywhere (0.0.0.0) in a list. | |
22. For "Name your Security Group", and use "Sawtooth Supply Chain" for the name and description. | |
The default group allows TCP ports 22 and 80 inbound for SSH and HTTP. | |
You can modify this later in the AWS dashboard. | |
23. Click the blue "Save" button | |
24. At the "Key Pair Settings" click"Create a key pair in EC2" | |
25. Click on "Create Key Pair". This takes you to a new tab or window | |
27. I named it "awscreatedkeypair" and click "Create". | |
This will create and download your private key to file awscreatedkeypair.pem. | |
Keep this downloaded file for use later on with ssh (I saved it to $HOME/.ssh ) | |
28. You should see your key pair listed. | |
Click the circular arrow refresh icon on the upper right if your key is not listed. | |
Check the key pair if it is not selected. | |
29. Go back to your AWS Marketplace "Hyperleder Sawtooth Supply Chain" webpage | |
30. Check the circular arrow refresh icon under "Key Pair Settings" and select the key you imported or created | |
31. After checking the settings (especially t2.micro instance and region), | |
click the orange "Launch" button in the lower right | |
32. You should see a message "Congratulations! An instance of this software is successfully deployed on EC2!" | |
33. Click on "EC2 Console" or go to https://console.aws.amazon.com/ec2/ | |
34. Find your running instance you just created in the list (it should be the only one) and | |
note the Instance ID, DNS (hostname), and "IPv4 Public IP". For example, I had: | |
i-01ee466c8294ab4d9 ec2-18-237-187-233.us-west-2.compute.amazonaws.com 18.237.187.233 | |
35. Click on the box to the left of this listing for details about the instance. | |
36. Navigate your web browser to your instance hostname or IP address to get started using Sawtooth Supply Chain's AssetTrack | |
For example http://18.237.187.233/ | |
37. Sign in the webpage with Username 'sawtooth' and your instance_id for Password (for example, i-01ee466c8294ab4d9 ) | |
You should see a page "Welcome to AssetTrack Powered by Sawtooth Supply Chain" with instructions | |
38. Create an account by clicking "Login/Signup" at the upper right then click "create a new Agent" | |
39. Try Click "Add Asset", fill in fields, then "Create Record" | |
40. Leave a comment or review at the Supply Chain AWS webpage | |
------------------------------------------------------- | |
Optional Exercise : Create and transfer an asset | |
1. Navigate your web browser to your instance hostname or IP address. | |
For example http://18.237.187.233/ | |
Sign in the webpage with Username 'sawtooth' and your instance_id for Password | |
(for example, i-01ee466c8294ab4d9 ) | |
2. Create an account by clicking "Login/Signup" at the upper right then click "create a new Agent" | |
3. Create user a | |
4. Create asset fisha under "Add Asset" | |
5. Logout and create user b | |
4. Login to usera and transfer fisha to userb (a "X" should appear to the transferee) | |
5. Login to userb, go to the asset fisha and click "accept" | |
(do *NOT* click on finalize, which closes out the asset) | |
Note: assets are not "push" in supply chain. They first require a "request" to transfer from the owner, | |
then and an "accept" from the new owner. | |
----------------------------- | |
How to Connect with SSH | |
1. First I copy the key pair I created and downloaded in the instructions above. It must be made read-only to use: | |
cp awscreatedkeypair.pem ~/.ssh | |
chmod 400 ~/.ssh/awscreatedkeypair.pem | |
2. SSH into your AWS instance as user ubuntu. Change this example to your hostname or IP address: | |
ssh -i ~/.ssh/awscreatedkeypair.pem -l ubuntu 18.237.187.233 | |
3. Here is a sample session: | |
$ ssh -i ~/.ssh/awscreatedkeypair.pem -l ubuntu 18.237.187.233 | |
The authenticity of host 'ec2-35-153-226-26.compute-1.amazonaws.com (35.153.226.26)' can't be established. | |
ECDSA key fingerprint is SHA256:pFTsviqrTk6z8/PT88Ilos1Rh7Sn1Z3Edz3Fqn9Vdhw. | |
Are you sure you want to continue connecting (yes/no)? yes | |
Warning: Permanently added 'ec2-35-153-226-26.compute-1.amazonaws.com,35.153.226.26' (ECDSA) to the list of known hosts. | |
Welcome to Ubuntu 16.04.3 LTS (GNU/Linux 4.4.0-1039-aws x86_64) | |
* Support: https://ubuntu.com/advantage | |
Get cloud support with Ubuntu Advantage Cloud Guest: | |
http://www.ubuntu.com/business/services/cloud | |
136 packages can be updated. | |
1 update is a security update. | |
*** System restart required *** | |
Last login: Thu Nov 16 21:25:33 2017 from 50.241.45.241 | |
ubuntu@ip-172-31-13-82:~$ sawtooth -V | |
sawtooth-cli (Hyperledger Sawtooth) version 0.8.9 | |
ubuntu@ip-172-31-13-82:~$ uname -a | |
Linux ip-172-31-13-82 4.4.0-1039-aws #48-Ubuntu SMP Wed Oct 11 15:15:01 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux | |
ubuntu@ip-172-31-13-82:~$ lsb_release -a | |
No LSB modules are available. | |
Distributor ID: Ubuntu | |
Description: Ubuntu 16.04.3 LTS | |
Release: 16.04 | |
Codename: xenial | |
ubuntu@ip-172-31-13-82:~$ ps -ef |grep sawtooth | |
sawtooth 1144 1 0 23:03 ? 00:00:00 /usr/bin/python3 /usr/bin/xo-tp-python -v tcp://localhost:4004 | |
sawtooth 1148 1 0 23:03 ? 00:00:00 /usr/bin/python3 /usr/bin/settings-tp -v tcp://localhost:4004 | |
rethink+ 1156 1 0 23:03 ? 00:00:01 /usr/bin/rethinkdb serve --config-file /etc/rethinkdb/instances.d/sawtooth-supply-chain.conf | |
sawtooth 1160 1 0 23:03 ? 00:00:00 /usr/bin/python3 /usr/bin/sawtooth-rest-api --connect tcp://localhost:4004 | |
sawtooth 1165 1 0 23:03 ? 00:00:00 /usr/bin/python3 /usr/bin/supply-chain-tp -v tcp://localhost:4004 | |
sawtooth 1169 1 0 23:03 ? 00:00:00 /usr/bin/python3 /usr/bin/intkey-tp-python -v tcp://localhost:4004 | |
sawtooth 1172 1 0 23:03 ? 00:00:00 /usr/bin/python3 /usr/bin/poet-validator-registry-tp -v tcp://localhost:4004 | |
sawtooth 1235 1 0 23:03 ? 00:00:01 /usr/bin/python3 /usr/bin/sawtooth-validator | |
sawtooth 1240 1 0 23:03 ? 00:00:01 /usr/bin/node /opt/sawtooth-supply-chain/server/index.js | |
rethink+ 1598 1156 0 23:03 ? 00:00:00 /usr/bin/rethinkdb serve --config-file /etc/rethinkdb/instances.d/sawtooth-supply-chain.conf | |
rethink+ 1674 1598 0 23:03 ? 00:00:00 /usr/bin/rethinkdb serve --config-file /etc/rethinkdb/instances.d/sawtooth-supply-chain.conf | |
ubuntu 24198 24160 0 23:21 pts/0 00:00:00 grep --color=auto sawtooth | |
ubuntu@ip-172-31-13-82:~$ exit | |
-------------------------------------- | |
Questions? Ask on the Sawtooth Supply Chain chat channel at | |
https://chat.hyperledger.org/channel/sawtooth-supply-chain (free Linux Foundation registration) | |
Further Information | |
* Hyperledger Sawtooth Supply Chain | |
https://aws.amazon.com/marketplace/pp/B077FLR7V5 | |
* Using AWS with Sawtooth | |
https://sawtooth.hyperledger.org/docs/core/releases/latest/app_developers_guide/aws.html | |
* Launching an AWS Marketplace Console | |
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/launch-marketplace-console.html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment