public async Task FunctionHandler(ILambdaContext context) { LambdaLogger.Log($"Executing the { context.FunctionName } function with a { context.MemoryLimitInMB }MB limit."); var helper = new EC2OperationsHelper(); var describeOperation = await helper.GetInstancesByTag(Constants.AUTO_STOP_TAG); LambdaLogger.Log(describeOperation.OperationReport); var changeOperation = await helper.StopEC2InstancesByInstanceIds(describeOperation.InstanceIds); LambdaLogger.Log(changeOperation.OperationReport); LambdaLogger.Log($"Finished executing the { context.FunctionName } function."); }
public async Task FunctionHandler(ILambdaContext context) { LambdaLogger.Log($"Executing the { context.FunctionName } function with a { context.MemoryLimitInMB }MB limit."); var helper = new EC2OperationsHelper(); // First, obtain instance ids to start var describeOperation = await helper.GetInstancesByTag(Constants.AUTO_START_TAG); LambdaLogger.Log(describeOperation.OperationReport); // start instances based on the returned ids var changeOperation = await helper.StartEC2InstancesByInstanceIds(describeOperation.InstanceIds); LambdaLogger.Log(changeOperation.OperationReport); LambdaLogger.Log($"Finished executing the { context.FunctionName } function."); }