In the serverless.yml
, the deployment profiles are set like this
custom:
defaultStage: dev
profiles:
dev: b***2_dev
prod: b***2_prod
suku: b***2_suku
While the default deploy is dev
, I would like to deploy the profile suku
without changing the defaultStage.
What is the command for this? sls deploy --profile suku
didn't work
Deploying function from an existing project yml file in the folder, and define your function within serverless. yml. Then open the command prompt, navigate to the folder, and hit sls deploy -v. That way, your existing function can also be deployed to AWS Lambda.
Login to your AWS account and go to the Identity & Access Management (IAM) page. Click on Users and then Add user. Enter a name in the first field to remind you this user is related to the Serverless Framework, like serverless-admin . Enable Programmatic access by clicking the checkbox.
Once the package is installed, add the following in the plugin section of your serverless. yml file. Add the plugin section if you don't already have it. This will start a local server that emulates AWS Lambda and API gateways on your local machine.
On newest versions of serverless (currently 1.26.1), you can provide the argument --aws-profile
ex: sls --aws-profile suku deploy
https://serverless.com/framework/docs/providers/aws/guide/credentials#using-the-aws-profile-option
However, in your case, another option could be to use "per stage" profile:
service: new-service
provider:
name: aws
runtime: nodejs6.10
stage: ${opt:stage, self:custom.defaultStage}
profile: ${self:custom.profiles.${self:provider.stage}}
custom:
defaultStage: dev
profiles:
dev: devProfile
prod: prodProfile
https://serverless.com/framework/docs/providers/aws/guide/credentials#per-stage-profiles
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With