Function: AWS EC2 Key Pair Info Get

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 Get AWS EC2 Key Pair Info

Public Function: EC2KeyPairInfoGet

public EC2KeyPairInfoGet(objAWSClient: AWSClient, arrEC2Filter?: EC2Filter[]): EC2KeyPairInfo[] {

    let objAmazonEC2Client: AmazonEC2Client = objAWSClient.getAmazonEC2Client();

    let objEC2DescribeKeyPairsRequest: EC2DescribeKeyPairsRequest = new EC2DescribeKeyPairsRequest();
    objEC2DescribeKeyPairsRequest.setIncludePublicKey(true);

    if (arrEC2Filter) {
        objEC2DescribeKeyPairsRequest.setFilters(arrEC2Filter);
    }

    let objEC2DescribeKeyPairsResult: EC2DescribeKeyPairsResult = objAmazonEC2Client.describeKeyPairs(objEC2DescribeKeyPairsRequest);

    let arrEC2KeyPairInfo: EC2KeyPairInfo[] = objEC2DescribeKeyPairsResult.getKeyPairs();

    return arrEC2KeyPairInfo;
}

Discover more from Cloud Build Tools

Subscribe to get the latest posts sent to your email.

You may also like