3
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Serverlessでランタイム環境が別の関数をデプロイできるようにする

Posted at

ちょっとしたサービスとかで、Node.jsとGoを利用するのに、serverless.ymlを分けたくなかったので調べてみました。

ランタイムは関数ごとに指定できる

Serverkessの公式ブログにありました。

How to use multiple runtimes in a single serverless microservice
https://serverless.com/blog/building-mutliple-runtimes/

runtime だけでなく、package も関数ごとに指定できました。

Serverless Framework Guide - AWS Lambda Guide - Packaging
https://serverless.com/framework/docs/providers/aws/guide/packaging#packaging-functions-separately

serverless.yml_関数ごとにruntimeを指定する例
service: hoge

provider:
  name: aws

functions:
  nuxt-renderer:
    runtime: nodejs8.10
    handler: handler.render
    memorySize: 512
    timeout: 30
    package:
      exclude:
        - ./**
      include:
        - .nuxt
        - node_modules
        - static
        - "*.js"

  api:
    handler: api/bin/main
    package:
      exclude:
        - ./**
      include:
        - api/bin/**

便利です^^

参考

How to use multiple runtimes in a single serverless microservice
https://serverless.com/blog/building-mutliple-runtimes/

Serverless Framework Guide - AWS Lambda Guide - Packaging
https://serverless.com/framework/docs/providers/aws/guide/packaging#packaging-functions-separately

3
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?