34c3254 Jun 5, 2018
4 contributors

Users who have contributed to this file

@gojko @royreiss @rickyblaha @pmarkert
88 lines (82 sloc) 5.62 KB


Create the initial lambda function and related security role.


claudia create {OPTIONS}


  • --region: AWS region where to create the lambda
    • For example: us-east-1
  • --handler: (optional) Main function for Lambda to execute, as module.function
    • For example: if it is in the main.js file and exported as router, this would be main.router
  • --api-module: (optional) The main module to use when creating Web APIs. If you provide this parameter, do not set the handler option. This should be a module created using the Claudia API Builder.
    • For example: if the api is defined in web.js, this would be web
  • --deploy-proxy-api: (optional) If specified, a proxy API will be created for the Lambda function on API Gateway, and forward all requests to function. This is an alternative way to create web APIs to --api-module.
  • --name: (optional) lambda function name
    • For example: awesome-microservice
    • Defaults to: the project name from package.json
  • --version: (optional) A version alias to automatically assign to the new function
    • For example: development
  • --source: (optional) Directory with project files
    • Defaults to: current directory
  • --config: (optional) Config file where the creation result will be saved
    • Defaults to: claudia.json
  • --policies: (optional) A directory or file pattern for additional IAM policies which will automatically be included into the security role for the function
    • For example: policies/*.json
  • --allow-recursion: (optional) Set up IAM permissions so a function can call itself recursively
  • --role: (optional) The name or ARN of an existing role to assign to the function. If not supplied, Claudia will create a new role. Supply an ARN to create a function without any IAM access.
    • For example: arn:aws:iam::123456789012:role/FileConverter
  • --runtime: (optional) Node.js runtime to use. For supported values, see
    • Defaults to: nodejs8.10
  • --description: (optional) Textual description of the lambda function
    • Defaults to: the project description from package.json
  • --memory: (optional) The amount of memory, in MB, your Lambda function is given. The value must be a multiple of 64 MB.
    • Defaults to: 128
  • --timeout: (optional) The function execution time, in seconds, at which AWS Lambda should terminate the function
    • Defaults to: 3
  • --no-optional-dependencies: (optional) Do not upload optional dependencies to Lambda.
  • --use-local-dependencies: (optional) Do not install dependencies, use local node_modules directory instead
  • --npm-options: (optional) Any additional options to pass on to NPM when installing packages. Check for more information
    • For example: --ignore-scripts
    • Introduced in version: 5.0.0
  • --cache-api-config: (optional) Name of the stage variable for storing the current API configuration signature. If set, it will also be used to check if the previously deployed configuration can be re-used and speed up deployment
    • For example: claudiaConfigCache
  • --post-package-script: (optional) the name of a NPM script to execute custom processing after claudia finished packaging your files. Note that development dependencies are not available at this point, but you can use npm uninstall to remove utility tools as part of this step.
    • For example: customNpmScript
    • Introduced in version: 5.0.0
  • --keep: (optional) keep the produced package archive on disk for troubleshooting purposes. If not set, the temporary files will be removed after the Lambda function is successfully created
  • --use-s3-bucket: (optional) The name of a S3 bucket that Claudia will use to upload the function code before installing in Lambda. You can use this to upload large functions over slower connections more reliably, and to leave a binary artifact after uploads for auditing purposes. If not set, the archive will be uploaded directly to Lambda
    • For example: claudia-uploads
  • --s3-sse: (optional) The type of Server Side Encryption applied to the S3 bucket referenced in --use-s3-bucket
    • For example: AES256
  • --aws-delay: (optional) number of milliseconds betweeen retrying AWS operations if they fail
    • For example: 3000
    • Defaults to: 5000
  • --aws-retries: (optional) number of times to retry AWS operations if they fail
    • For example: 15
    • Defaults to: 15
  • --security-group-ids: (optional) A comma-delimited list of AWS VPC Security Group IDs, which the function will be able to access. Note: these security groups need to be part of the same VPC as the subnets provided with --subnet-ids.
    • For example: sg-1234abcd
  • --subnet-ids: (optional) A comma-delimited list of AWS VPC Subnet IDs, which this function should be able to access. At least one subnet is required if you are using VPC access. Note: these subnets need to be part of the same VPC as the security groups provided with --security-group-ids.
    • For example: subnet-1234abcd,subnet-abcd4567
  • --set-env: (optional) comma-separated list of VAR=VALUE environment variables to set
    • For example: S3BUCKET=testbucket,SNSQUEUE=testqueue
  • --set-env-from-json: (optional) file path to a JSON file containing environment variables to set
    • For example: production-env.json
  • --env-kms-key-arn: (optional) KMS Key ARN to encrypt/decrypt environment variables