When I run sls deploy --stage prod I end up with a new API named prod-MYAPI instead of having it deploy to the prod stage of the MYAPI. Why is this?
In my serverless.yml, I have this:
service: MYAPI
provider:
name: aws
runtime: nodejs8.10
stage: dev
memorySize: 512
tags:
env: ${self:provider.stage}
region: us-east-1
profile: devprofile
iamRoleStatements:
- Effect: Allow
Action:
- dynamodb:Query
- dynamodb:Scan
- dynamodb:GetItem
- dynamodb:PutItem
- dynamodb:UpdateItem
- dynamodb:DeleteItem
- dynamodb:BatchWriteItem
- dynamodb:BatchGetItem
Resource:
- "arn:aws:dynamodb:${opt:region, self:provider.region}:*:table/ps_${self:provider.stage}_users"
- "arn:aws:dynamodb:${opt:region, self:provider.region}:*:table/ps_${self:provider.stage}_sessions"
- Effect: Allow
Action: ses:SendEmail
Resource: "*"
environment:
STAGE: ${self:provider.stage}
The first time I deployed, I ran sls deploy and got an API named dev-MYAPI, which I renamed to just MYAPI in the AWS console.
In AWS API-Gateway, under APIS, I saw just one API, named MYAPI. In the list of stages for that API, I created 4 stages, dev, test, staging and prod. I then ran this:
sls deploy --stage prod
After I ran that, I got a new API named prod-MYAPI in the APIS section of API-Gateway console. I did not see anything new (no new deployment set) for the prod stage of MYAPI.
Why is this happening? I’ve spent a couple of hours on this, and can’t figure out what I have set wrong.