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
public EC2NetworkInterfaceCreate(objAWSClient: AWSClient, strDescription: string, strPrivateIpAddressPrimary: string, objEC2Subnet: EC2Subnet, arrGroupId: string[], strInterfaceType: "interface" | "efa" | "efa-only" | "trunk" = "interface"): EC2NetworkInterface {
let objEC2PrivateIpAddressSpecificationPrimary: EC2PrivateIpAddressSpecification = new EC2PrivateIpAddressSpecification();
objEC2PrivateIpAddressSpecificationPrimary.setPrimary(true);
objEC2PrivateIpAddressSpecificationPrimary.setPrivateIpAddress(strPrivateIpAddressPrimary);
let arrEC2PrivateIpAddressSpecification: EC2PrivateIpAddressSpecification[] = [];
arrEC2PrivateIpAddressSpecification.push(objEC2PrivateIpAddressSpecificationPrimary);
let objAmazonEC2Client: AmazonEC2Client = objAWSClient.getAmazonEC2Client();
let objEC2CreateNetworkInterfaceRequest: EC2CreateNetworkInterfaceRequest = new EC2CreateNetworkInterfaceRequest();
objEC2CreateNetworkInterfaceRequest.setDescription(strDescription);
objEC2CreateNetworkInterfaceRequest.setPrivateIpAddresses(arrEC2PrivateIpAddressSpecification);
objEC2CreateNetworkInterfaceRequest.setSubnetId(objEC2Subnet.getSubnetId());
objEC2CreateNetworkInterfaceRequest.setGroups(arrGroupId);
objEC2CreateNetworkInterfaceRequest.setInterfaceType(strInterfaceType);
let objEC2CreateNetworkInterfaceResult: EC2CreateNetworkInterfaceResult = objAmazonEC2Client.createNetworkInterface(objEC2CreateNetworkInterfaceRequest);
let objEC2NetworkInterface: EC2NetworkInterface = objEC2CreateNetworkInterfaceResult.getNetworkInterface();
return objEC2NetworkInterface;
}Discover more from Cloud Build Tools
Subscribe to get the latest posts sent to your email.
