version: 0.2

phases:
  install:
    commands:
      - npm install -g serverless
  build:
    commands:
      - mkdir deploy
      - ls
      - mv cloudformation-template-create-stack.json ./deploy/
      - mv cloudformation-template-update-stack.json ./deploy/
      - mv serverless-rest-api-with-dynamodb.zip ./deploy/
      - mv serverless-state.json ./deploy/
      - ls -R
      - serverless deploy --region $region --stage $stage --package deploy
      - aws apigateway get-rest-apis


version: 0.2

phases:
  install:
    commands:
      - npm install -g serverless
  build:
    commands:
      - mkdir deploy
      - ls
      - mv cloudformation-template-create-stack.json ./deploy/
      - mv cloudformation-template-update-stack.json ./deploy/
      - mv serverless-rest-api-with-dynamodb.zip ./deploy/
      - mv serverless-state.json ./deploy/
      - ls -R
      - serverless deploy --region $region --stage   --package deploy
      - aws apigateway get-rest-apis
      - stage='s1-serverless-rest-api-with-dynamodb'
      - qs="'items[?name==\`"
      - qs+=$stage
      - qs+="\`].{id:id}'"
      - id=`eval aws apigateway get-rest-apis --query $qs --output text`
      - echo modify $id


Update deploy to extract rest-api id
Update deploy to extract rest-api id
