import { EC2Client } from "@aws-sdk/client-ec2"; import { SSMClient } from "@aws-sdk/client-ssm"; import type { DiskTypeForVM } from "../types/enums"; import { EC2Instance } from "../types/index"; /** * Create a new AWS EC2 client. * @returns > - the EC2 client instance. */ export declare const createEC2Client: () => Promise; /** * Create a new AWS SSM client. * @returns > - the SSM client instance. */ export declare const createSSMClient: () => Promise; /** * Return the list of bootstrap commands to be executed. * @dev the startup commands must be suitable for a shell script. * @param bucketName - the name of the AWS S3 bucket. * @returns > - the list of startup commands to be executed. */ export declare const vmBootstrapCommand: (bucketName: string) => Array; /** * Return the list of Node environment (and packages) installation plus artifact caching for contribution verification. * @param zKeyPath - the path to zKey artifact inside AWS S3 bucket. * @param potPath - the path to ptau artifact inside AWS S3 bucket. * @param snsTopic - the SNS topic ARN. * @param region - the AWS region. * @returns > - the array of commands to be run by the EC2 instance. */ export declare const vmDependenciesAndCacheArtifactsCommand: (zKeyPath: string, potPath: string, snsTopic: string, region: string) => Array; /** * Return the list of commands for contribution verification. * @dev this method generates the verification transcript as well. * @param bucketName - the name of the AWS S3 bucket. * @param lastZkeyStoragePath - the last zKey storage path. * @param verificationTranscriptStoragePathAndFilename - the verification transcript storage path. * @returns Array - the list of commands for contribution verification. */ export declare const vmContributionVerificationCommand: (bucketName: string, lastZkeyStoragePath: string, verificationTranscriptStoragePathAndFilename: string) => Array; /** * Compute the VM disk size. * @dev the disk size is computed using the zKey size in bytes taking into consideration * the verification task (2 * zKeySize) + ptauSize + OS/VM (~8GB). * @param zKeySizeInBytes the size of the zKey in bytes. * @param pot the amount of powers needed for the circuit (index of the PPoT file). * @return the configuration of the VM disk size in GB. */ export declare const computeDiskSizeForVM: (zKeySizeInBytes: number, pot: number) => number; /** * Creates a new EC2 instance * @param ec2 - the instance of the EC2 client. * @param commands > - the list of commands to be run on the EC2 instance. * @param instanceType - the type of the EC2 VM instance. * @param diskSize - the size of the disk (volume) of the VM. * @param diskType - the type of the disk (volume) of the VM. * @returns > the instance that was created */ export declare const createEC2Instance: (ec2: EC2Client, commands: string[], instanceType: string, volumeSize: number, diskType: DiskTypeForVM) => Promise; /** * Check if the current VM EC2 instance is running by querying the status. * @param ec2 - the instance of the EC2 client. * @param instanceId - the unique identifier of the EC2 VM instance. * @returns > - true if the current status of the EC2 VM instance is 'running'; otherwise false. */ export declare const checkIfRunning: (ec2Client: EC2Client, instanceId: string) => Promise; /** * Start an EC2 VM instance. * @dev the instance must have been created previously. * @param ec2 - the instance of the EC2 client. * @param instanceId - the unique identifier of the EC2 VM instance. */ export declare const startEC2Instance: (ec2: EC2Client, instanceId: string) => Promise; /** * Stop an EC2 VM instance. * @dev the instance must have been in a running status. * @param ec2 - the instance of the EC2 client. * @param instanceId - the unique identifier of the EC2 VM instance. */ export declare const stopEC2Instance: (ec2: EC2Client, instanceId: string) => Promise; /** * Terminate an EC2 VM instance. * @param ec2 - the instance of the EC2 client. * @param instanceId - the unique identifier of the EC2 VM instance. */ export declare const terminateEC2Instance: (ec2: EC2Client, instanceId: string) => Promise; /** * Run a command on an EC2 VM instance by using SSM. * @dev this method returns the command identifier for checking the status and retrieve * the output of the command execution later on. * @param ssm - the instance of the sSM client. * @param instanceId - the unique identifier of the EC2 VM instance. * @param commands > - the list of commands. * @return > - the unique identifier of the command. */ export declare const runCommandUsingSSM: (ssm: SSMClient, instanceId: string, commands: Array) => Promise; /** * Get the output of an SSM command executed on an EC2 VM instance. * @param ssm - the instance of the sSM client. * @param instanceId - the unique identifier of the EC2 VM instance. * @param commandId - the unique identifier of the command. * @return > - the command output. */ export declare const retrieveCommandOutput: (ssm: SSMClient, instanceId: string, commandId: string) => Promise; /** * Get the status of an SSM command executed on an EC2 VM instance. * @param ssm - the instance of the sSM client. * @param instanceId - the unique identifier of the EC2 VM instance. * @param commandId - the unique identifier of the command. * @return > - the command status. */ export declare const retrieveCommandStatus: (ssm: SSMClient, instanceId: string, commandId: string) => Promise; //# sourceMappingURL=vm.d.ts.map