Amplifyを導入しているプロジェクトで開発中に、Amplifyのメジャーバージョンアップが行われたのでバージョンアップ対応しました。加えて、LambdaのNode8がサポートされなくなるニュースを聞いたのでここは今後を考えバージョンアップしておくのがベターだと考える。

まず、Amplifyのバージョンアップを行う。

$ npm install -g @aws-amplify/cli

プロジェクトのルートで新たにAmplify関連のコマンドを実行してみる。
私の場合はamplify pullを実行した。
そうすると、既存のクラウドフォーメーションのテンプレートのLambdaバージョンで警告が表示される。(旧AmplifyはNode8系でデプロイしていたのでバージョンアップを促される)

$ amplify pull

Amplify CLI uses Lambda backed custom resources with CloudFormation to manage part of your backend resources.
In response to the Lambda Runtime support deprecation schedule
https://docs.aws.amazon.com/lambda/latest/dg/runtime-support-policy.html
Nodejs runtime need to be updated from nodejs8.10  to nodejs10.x in the following template files:
/Users/username/Code/project/amplify/backend/auth/xxxxxx/xxxxxx-cloudformation-template.yml
/Users/username/Code/project/amplify/backend/auth/userPoolGroups/template.json
/Users/username/Code/project/amplify/backend/function/AdminQueriesxxxxxx/AdminQueriesxxxxxx-cloudformation-template.json
/Users/username/Code/project/amplify/backend/function/xxxxxxCustomMessage/xxxxxxCustomMessage-cloudformation-template.json
/Users/username/Code/project/amplify/backend/function/xxxxxxPostConfirmation/xxxxxxPostConfirmation-cloudformation-template.json

Please test the changes in a test environment before pushing these changes to production. There might be a need to update your Lambda function source code due to the NodeJS runtime update. Please take a look at https://aws-amplify.github.io/docs/cli/lambda-node-version-update for more information

? Confirm to update the NodeJS runtime version to 10.x : 

では置換してもらう。

? Confirm to update the NodeJS runtime version to 10.x : Yes

NodeJS runtime version updated successfully to 10.x in all the CloudFormation templates.
Make sure the template changes are pushed to the cloud by "amplify push"

ごっそり書き換わっている。

$ git status
        modified:   amplify/.config/project-config.json
        modified:   amplify/backend/auth/xxxxxx/xxxxxx-cloudformation-template.yml
        modified:   amplify/backend/auth/userPoolGroups/template.json
        modified:   amplify/backend/function/AdminQueriesxxxxxx/AdminQueriesxxxxxx-cloudformation-template.json
        modified:   amplify/backend/function/xxxxxxCustomMessage/xxxxxxCustomMessage-cloudformation-template.json
        modified:   amplify/backend/function/xxxxxxPostConfirmation/xxxxxxPostConfirmation-cloudformation-template.json

デプロイしてみる。

$ amplify push 
✔ Successfully pulled backend environment prd from the cloud.

Current Environment: prd

| Category  | Resource name                       | Operation | Provider plugin   |
| --------- | ----------------------------------- | --------- | ----------------- |
| Auth      | xxxxxx                              | Update    | awscloudformation |
| Api       | xxxxxx                              | Update    | awscloudformation |
| Providers | categories                          | Delete    |                   |
| Auth      | userPoolGroups                      | No Change | awscloudformation |
| Function  | AdminQueriesxxxxxx                  | No Change | awscloudformation |
| Function  | xxxxxxCustomMessage    | No Change  | awscloudformation |
| Function  | xxxxxxPostConfirmation | No Change  | awscloudformation |
| Api       | AdminQueries                        | No Change | awscloudformation |

・・・・・
・・・・・

GraphQL endpoint: https://xxxxxx.appsync-api.ap-northeast-1.amazonaws.com/graphql
Hosted UI Endpoint: https://xxxxxx-xxxxxx-prd.auth.ap-northeast-1.amazoncognito.com/
Test Your Hosted UI Endpoint: https://xxxxxx-xxxxxx-prd.auth.ap-northeast-1.amazoncognito.com/login?response_type=code&client_id=xxxxxx&redirect_uri=https://xxxxxx.com/thankyou/

成功!
エラーでずにデプロイできた。