Ad space (banner)
AD

Got the fundamentals? A structured AWS course is a fast way to level up.

Find AWS courses on Udemy

Affiliate link. Costs you nothing extra.

☁️AWS Lessons
Lesson 35 / 41

Creating a Function with aws lambda create-function

When you want to deploy code to Lambda, use aws lambda create-function. It creates a new function.

The syntax is aws lambda create-function --function-name name --runtime runtime --handler handler --role role-arn.

Running aws lambda create-function --function-name my-func --runtime nodejs20.x creates the function and returns its ARN and configuration.

A common stumble is omitting the execution role. Every function needs an IAM role granting it permission to write logs and reach other services.

In real work, functions are deployed by CI or by a framework rather than by this command directly, but knowing it clarifies what those tools do.

AWS
Try it (type this into the pseudo terminal)
aws lambda create-function --function-name my-func --runtime nodejs20.x

🧑‍💻 You can type this command into the AWS pseudo terminal to try it yourself (this page itself has no interactive terminal).

Ad space (banner)
Ad space (in-article)