amazon-web-servicesaws-lambdaclaudiajs

Deploy Lambda in root rather than in 'latest' with claudiajs


According to claudiajs tutorial and many other tutorials, by default, it's always deployed in latest folder rather than the root.

Is there a way to deploy to the root (i.e. https://8x7uh8ho5k.execute-api.us-east-1.amazonaws.com), rather than in latest folder (i.e. https://8x7uh8ho5k.execute-api.us-east-1.amazonaws.com/latest)?


Solution

  • I'm not familiar with Claudia.js, I'll explain this from the API Gateway perspective. The latest value after the API Gateway invoke URL is actually the API Gateway Stage. A stage is used to deploy the changes made to the API Gateway's resources so that it is available when you hit the invoke URL. You can create multiple stages so as to maintain different versions of your API, say "dev" and "production". However, a stage is required and you cannot deploy changes to "root". The invoke URL would look like:

    https://{restapi_id}.execute-api.{region}.amazonaws.com/{stage_name}/
    

    If you don't want to specify the stage name when invoking the API, you could look into using Custom Domain Names.

    If you'd like to change the stage name when deploying the API with Claudia.js, look into the documentation for Claudia to check if that is possible.