I am learning about How to Deploy Hyperledger Fabric on AWS with Blockchain Templates.
from this tutorial https://medium.com/faun/how-to-deploy-hyperledger-fabric-on-aws-with-blockchain-templates-12ff1b219d98
I have tried to follow every single steps but realized there are something missing from his steps and I tried putting in the missing pieces but somehow still getting error while creating.
I tried to google around but doesn't seem to be able to find much much.
Wondering if there's anyone able to give me suggestions / advice.
I will try writing out steps of what I have done.
I created a new by launching VPC wizard with
VPC with a single public subnet
I named thisBlockChainVPC
I created a new EC2 and chose the first AMI
Amazon Linux 2 AMI (HVM), SSD Volume Type
, I configured the network to use the VPC I created in previous step, then left the other instance details as default. As for security group, I created a new security group namedHyperledge
with inbound rules of HTTP + HTTPS to be accessible anywhere. As for outbound, it's open to all traffic. As for PEM, I created new PEM namedblockchainbook
I created one elastic ip with the setting of
us-west-2
for network border group. I created both ec2 + vpc in Oregon (us-west-2). Then I associated this elastic ip to the ec2 I created previously.I created another security group named
blockchainbook
with SSH + 8080 as inbound rules and all traffic for outbound. This security group is with the new VPC(blockchainVPC)I created a new policy under IAM named
EC2BC
, I added full access toElastic Container Registry
andElastic Container Service
andS3
with resources asall resources
I created a new role named
EC2Blockchain
withaws service
and common use case ofEC2
I attached the policy I created above (EC2BC) into this role.I went back to the EC2 created in step 2, then attached the
EC2Blockchain
role to it.I went to this page from aws https://aws.amazon.com/blockchain/templates/getting-started/ and chose
Launch in US West (Oregon) region (us-west-2)
to launch hyperledger fabric which brings me to cloudformation with the a template url of hyperledger fabric. As for stack name I enteredBlockchainStack
. VPC Connection, I choseBlockChainVPC
which I created in step 1. Subnet, I chose the subnet that was created with theBlockchainVPC
. EC2 Key pair I chose the one I created with ec2 in step 2. Security group, I choose theblockchainbook
I created in step 4. As for EC2 Instance Profile ARN, I chose theRole ARN
from the role I created in step 6.Finally I started to create the stack and see that it's in progress because of the state
CREATE_IN_PROGRESS
, after a few minutes I see an error ofEmbedded stack arn:aws:cloudformation:us-west-2:234234234:stack/BlockchainStack-FabricEC2CommonStack-1OF23423423/234234234-234234234-234 was not successfully created: The following resource(s) failed to create: [EC2InstanceForDev].
After the error I tried recreating the stack again all settings are the sam except the EC2 Instance Profile ARN, this time I chose Instance Profile ARNs
from the role I created in step 6. But error is still the same, no luck.
I also thought it might be the role permission I set or the security group I had wrong so I even tried to attach the admin policy into the role and all traffic to both inbound + outbound for the security group but still no luck.
Does anyone has suggession / advice for this?
Thanks in advance for any help.
The Official AWS Blockchain Cloud Formation Template for Hyperledger Fabric is a nested template (our base template calls another template which does all the setup on an EC2 instance which itself creates).
But the problem is it does everything on the EC2-Instance except installing docker-compose & it throws an error that docker-compose command not found at the end which causes the CloudFormation template to break(EC2InstanceForDev) and do a rollback. So instead of using CloudFormation Template, we can run the same script manually on the EC2-instance with a small change. The change is to install docker-compose beforehand. Rest setup remains the same i.e -- 1. Create a VPC, 2. Create Public Subnets, 3. Create EIP if you want to attach it later, 4. Create Key-Pair for SSH, 5. Create IAM Role & Policy, 6. Create Security Group with Inbound 8080(TCP) & 22(SSH), 7. launch an EC2 Instance with the created resources in step (1to6).
AMI which is preferred is -
Docker Image Repository -
SCRIPT TO RUN ON EC2 (Give chmod 777 and chmod +x for the script) -
IAM policy which I attached to the role -
NOTE - Please replace the appropriate AWS ECR account number for your region and appropriate AWS region in the above script and script has (example.com org1 org2 org3 mychannel), Please change this too as per requirement. Its the same RootDomain, Org1SubDomain, Org2SubDomain, Org3SubDomain, ChannelName as we enter in the CF template).
This whole process is tested in the us-east-1 region. The script can be straight deployed in the us-east-1 region. To access the Hyperledger web monitor interface (
http://EC2-DNS OR EIP:8080
)