14 Serverless Framework
DodaTech
1 min read
title: Serverless Framework for Serverless API Development weight: 24 date: 2026-06-28 lastmod: 2026-06-28 description: Use Serverless Framework for infrastructure-as-code deployment of serverless APIs including serverless.yml configuration, plugins, stages, and multi-region deployment. tags: [api-development, serverless]
Serverless Framework provides infrastructure-as-code for serverless applications using serverless.yml to define functions, events, resources, and plugins, enabling repeatable deployments across stages and regions.
```yaml
# serverless.yml
service: my-api
provider:
name: aws
runtime: python3.11
region: us-east-1
stage: ${opt:stage, 'dev'}
environment:
TABLE_NAME: ${self:service}-${self:provider.stage}-users
STAGE: ${self:provider.stage}
iamRoleStatements:
- Effect: Allow
Action: dynamodb:*
Resource: arn:aws:dynamodb:*:*:table/${self:service}-${self:provider.stage}-*
functions:
createUser:
handler: handlers/users.create
events:
- http:
path: users
method: post
cors: true
getUser:
handler: handlers/users.get
events:
- http:
path: users/{id}
method: get
cors: true
listUsers:
handler: handlers/users.list
events:
- http:
path: users
method: get
cors: true
resources:
Resources:
UsersTable:
Type: AWS::DynamoDB::Table
Properties:
TableName: ${self:service}-${self:provider.stage}-users
AttributeDefinitions:
- AttributeName: id
AttributeType: S
KeySchema:
- AttributeName: id
KeyType: HASH
BillingMode: PAY_PER_REQUEST
plugins:
- serverless-offline
What's Next
Now learn about serverless-offline in Building Serverless APIs.
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro