Orchestrator Function: AWS EC2 Network Interface Create

by Simon Sparks · 7 February 2026

To use this function add it to the class library file named OrchestratorPluginAWSService.ts

GitHub Repository: https://github.com/SimonSparksUK/Orchestrator

Filename: OrchestratorPluginAWSService.ts

Description: Orchestrator Function to Create a AWS EC2 Network Interface

Private Function: EC2NetworkInterfaceCreate

publicEC2NetworkInterfaceCreate(objAWSClient:AWSClient,strDescription:string,strPrivateIpAddressPrimary:string,objEC2Subnet:EC2Subnet,arrGroupId:string[],strInterfaceType:"interface"|"efa"|"efa-only"|"trunk"="interface"):EC2NetworkInterface{

letobjEC2PrivateIpAddressSpecificationPrimary:EC2PrivateIpAddressSpecification=newEC2PrivateIpAddressSpecification();
objEC2PrivateIpAddressSpecificationPrimary.setPrimary(true);
objEC2PrivateIpAddressSpecificationPrimary.setPrivateIpAddress(strPrivateIpAddressPrimary);

letarrEC2PrivateIpAddressSpecification:EC2PrivateIpAddressSpecification[]= [];
arrEC2PrivateIpAddressSpecification.push(objEC2PrivateIpAddressSpecificationPrimary);

letobjAmazonEC2Client:AmazonEC2Client=objAWSClient.getAmazonEC2Client();

letobjEC2CreateNetworkInterfaceRequest:EC2CreateNetworkInterfaceRequest=newEC2CreateNetworkInterfaceRequest();
objEC2CreateNetworkInterfaceRequest.setDescription(strDescription);
objEC2CreateNetworkInterfaceRequest.setPrivateIpAddresses(arrEC2PrivateIpAddressSpecification);
objEC2CreateNetworkInterfaceRequest.setSubnetId(objEC2Subnet.getSubnetId());
objEC2CreateNetworkInterfaceRequest.setGroups(arrGroupId);
objEC2CreateNetworkInterfaceRequest.setInterfaceType(strInterfaceType);

letobjEC2CreateNetworkInterfaceResult:EC2CreateNetworkInterfaceResult=objAmazonEC2Client.createNetworkInterface(objEC2CreateNetworkInterfaceRequest);

letobjEC2NetworkInterface:EC2NetworkInterface=objEC2CreateNetworkInterfaceResult.getNetworkInterface();

returnobjEC2NetworkInterface;
}

Discover more from Cloud Build Tools

Subscribe to get the latest posts sent to your email.

You may also like