Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 32 additions & 1 deletion src/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,21 @@ export class EthereumNode extends constructs.Construct {
*/
readonly availabilityZone: string;

/**
* The ID of the node
*/
readonly nodeId: string;

/**
* The node's HTTP endpoint
*/
readonly httpEndpoint: string;

/**
* The node's Web Socket endpoint
*/
readonly webSocketEndpoint: string;

/**
* Creates an Ethereum public network node on an Amazon Managed Blockchain network
*/
Expand Down Expand Up @@ -112,13 +127,29 @@ export class EthereumNode extends constructs.Construct {
/**
* Build out CloudFormation resources populating with input values or defaults if none provided
*/
new managedblockchain.CfnNode(this, id, {
const cfnNode = new managedblockchain.CfnNode(this, id, {
networkId: this.network,
nodeConfiguration: {
availabilityZone: this.availabilityZone,
instanceType: this.instanceType,
},
});

/**
* Set class properties using CfnNode
*/

// Node ID

this.nodeId = cfnNode.attrNodeId;

// Node Endpoints

const httpEndpointPrefix = 'https://';
const webSocketEndpointPrefix = 'wss://';
const endpointSuffix = `.ethereum.managedblockchain.${this.region}.amazonaws.com`;

this.httpEndpoint = `${httpEndpointPrefix}${this.nodeId}${endpointSuffix}`;
this.webSocketEndpoint = `${webSocketEndpointPrefix}${this.nodeId}.wss${endpointSuffix}`;
}
}