Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Serverless Framework: how to deploy with CloudFormation?

I am new to the serverless framework. Well, at least to the latest version, which depends heavily on CloudFormation.

I installed the framework globally on my computer using:

npm install -g serverless

I then created a service using:

serverless create --template aws-nodejs --path myService

Finally, I ran:

serverless deploy

Everything seems to deploy normally, it shows no error in the terminal. I can see the CloudFormation files in a newly created, dedicated S3 bucket.

However, I cannot find the default hello Lambda function in the AWS Lambda console.

What am I missing? Are the CloudFormation files not supposed to create Lambda functions upon deployment?

like image 673
Manube Avatar asked Mar 13 '26 14:03

Manube


1 Answers

The reason the default hello Lambda function is not listed in the AWS Lambda console is because your Lambda function was uploaded to the default region (us-east-1), while the Lambda console displays the functions of another region.

To set the correct region for your functions, you can use the region field of the serverless.yml file.

Make sure the region property is directly under the provider section. With 2/4 spaces indent. Like this:

provider:
    region: eu-west-1

Alternatively, you can specify the region at deployment time, like so:

sls deploy --region eu-west-1
like image 101
doorstuck Avatar answered Mar 16 '26 04:03

doorstuck



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!