title: How to increase the timeout for AWS Lambda client
body: <p>I am trying to scan a file using AWS Lambda, and I am getting timeout since the scan function is taking longer than expected.</p>
  
  <p>I would like to increase the timeout for my client since this process is @Async and I can handle few more seconds.</p>
  
  <p>This is my method:</p>
  
  <pre><code>   @Override
     @Async
     public void scanFile( String s3Bucket, String fileName, String path, String documentId, String createdBy ) throws IOException {
  
        FileScanInput input = new FileScanInput();
        input.setS3Bucket( s3Bucket );
        input.setS3Key( path );
  
        logger.debug( "Scan file: " + path + ", in S3 bucket:  " + s3Bucket );
        if ( fileScanService == null ) {
           fileScanService = buildFileScanService();
        }
  
        FileScanOutput fileScanOutput = fileScanService.scanFile( input );
  //      TODO: if the scan process failed, ask what should be the next step.
  //      for now, the file stays in S3.
        Assert.notNull( fileScanOutput );
        String status = fileScanOutput.getStatus();
  
        // in case the document owner was not found an infected file was file. Email approved emails
        if ( status.equalsIgnoreCase( VIRUS_SCAN_INFECTED ) ) {
           // delete file on S3
           this.deleteFile( s3Bucket, path );
           String toEmail = personInfoMapper.findStudentEmail( createdBy );
           try {
              sendVirusDetectedEmail( fileName, toEmail );
           }
           catch ( Exception e ) {
              logger.error( e.getMessage() );
           }
  
           //         we clean up the metadata table in case there was a virus since this is running async.
           metadataDao.cleanUpMetadata( documentId );
  
           logger.error( "The file is infected." );
           throw new VirusFoundException( "File is infected." );
        }
     }
  
  
     public final FileScanService buildFileScanService() {
        return LambdaInvokerFactory.builder().lambdaClient( AWSLambdaClientBuilder.defaultClient() ).build( FileScanService.class );
     }
  </code></pre>
  
  <p>And this is the resource configs for my Lambda function.
  <a href="https://i.stack.imgur.com/9xcWG.png" rel="noreferrer"><img src="https://i.stack.imgur.com/9xcWG.png" alt="enter image description here"></a></p>
  
  <p><strong>Update</strong>
  I also noticed that my Lambda function actually does its job, which means the issue is basically in this line
  <code>FileScanOutput fileScanOutput = fileScanService.scanFile( input );</code></p>
  
  <p>fileScanOutput doesn't get initialized instead I get timeout issue.</p>
  
  <p>My other classes look like:</p>
  
  <pre><code>public interface FileScanService {
  
     @LambdaFunction( functionName = "s3-antivirus-api-scan" )
     public FileScanOutput scanFile( FileScanInput fileScanInput );
  }
  
  public class FileScanInput {
  
     private String s3Bucket;
     private String s3Key;
  
     public String getS3Bucket() {
        return s3Bucket;
     }
  
     public void setS3Bucket( String value ) {
        s3Bucket = value;
     }
  
     public String getS3Key() {
        return s3Key;
     }
  
     public void setS3Key( String value ) {
        s3Key = value;
     }
  }
  
  
  
  public class FileScanOutput {
  
     private String status;
  
     public FileScanOutput() {
     }
  
     public FileScanOutput( String status ) {
        this.status = status;
     }
  
     public String getStatus() {
        return status;
     }
  
     public void setStatus( String value ) {
        status = value;
     }
  }
  </code></pre>