Softwr

Identity and Access Management · head to head

Amazon Cognito vs AWS Serverless Application Model (AWS SAM)

Amazon Cognito logo

Amazon Cognito

Identity and Access Management

AWS customer identity service for sign-in, federation and access tokens, priced per active user

From
Free
Free plan
Yes
AWS Serverless Application Model (AWS SAM) logo

AWS Serverless Application Model (AWS SAM)

Developer Tools

Open-source framework and CLI for building serverless apps on AWS

From
Free
Free plan
Yes

The short version

  • AWS Serverless Application Model (AWS SAM) is free; Amazon Cognito starts at $0.015/mo.
  • Only Amazon Cognito lists social, SAML and OIDC federation; only AWS Serverless Application Model (AWS SAM) lists SAM connectors for IAM permissions.
  • Where Amazon Cognito falls short: SMS and email delivery are billed separately through SNS and SES.
  • Where AWS Serverless Application Model (AWS SAM) falls short: targets AWS only, so templates are not portable to other cloud providers.

How do Amazon Cognito and AWS Serverless Application Model (AWS SAM) differ?

Amazon Cognito and AWS Serverless Application Model (AWS SAM) differ on pricing model (Usage-based against Open-source), platforms and category. Only the attributes on which Amazon Cognito and AWS Serverless Application Model (AWS SAM) actually diverge.

Attributes where Amazon Cognito and AWS Serverless Application Model (AWS SAM) differ
AttributeAmazon CognitoAWS Serverless Application Model (AWS SAM)
Pricing modelUsage-basedOpen-source
PlatformsWebWindows, macOS, Linux
CategoryIdentity and Access ManagementDeveloper Tools

Identical on both: starting price (Free), free tier (Yes).

Which features does each one have?

They share no listed features; 9 appear only for Amazon Cognito and 7 only for AWS Serverless Application Model (AWS SAM). Drawn from each product's published feature list. An absence here means we hold no record of it - not that the product lacks it.

Only in Amazon Cognito

  • User pools with sign-up and sign-in
  • Social, SAML and OIDC federation
  • Passkeys and one-time passwords
  • OAuth 2.0 machine-to-machine tokens
  • Managed Login with UI editor
  • Adaptive authentication on Plus
  • Compromised credential detection
  • Multi-Region replication

Only in AWS Serverless Application Model (AWS SAM)

  • SAM template shorthand for CloudFormation
  • SAM CLI project scaffolding with sam init
  • Local testing of Lambda functions and API endpoints
  • sam sync for syncing local changes to the cloud
  • SAM connectors for IAM permissions
  • Terraform project debugging support
  • CI/CD pipeline support

What is each one used for?

Amazon Cognito is most often brought in for customer sign-in for AWS-hosted apps; AWS Serverless Application Model (AWS SAM) for defining Lambda and API Gateway applications as code. The jobs each tool is most often brought in to do.

Amazon Cognito

  • Customer sign-in for AWS-hosted appsnot AWS Serverless Application Model (AWS SAM)
  • Federating enterprise SAML and OIDC identity providersnot AWS Serverless Application Model (AWS SAM)
  • Machine-to-machine tokens for microservicesnot AWS Serverless Application Model (AWS SAM)
  • Passwordless login with passkeysnot AWS Serverless Application Model (AWS SAM)
  • Authenticating AI agents on AWSnot AWS Serverless Application Model (AWS SAM)

AWS Serverless Application Model (AWS SAM)

  • Defining Lambda and API Gateway applications as codenot Amazon Cognito
  • Testing Lambda functions locally before deploymentnot Amazon Cognito
  • Building CI/CD pipelines for serverless appsnot Amazon Cognito
  • Converting console-created resources into templatesnot Amazon Cognito

Where do Amazon Cognito and AWS Serverless Application Model (AWS SAM) fall short?

Amazon Cognito's most cited limit: SMS and email delivery are billed separately through SNS and SES. AWS Serverless Application Model (AWS SAM)'s: targets AWS only, so templates are not portable to other cloud providers. Documented limitations, not opinions. Every one is a constraint you would hit in normal use.

Amazon Cognito

  • SMS and email delivery are billed separately through SNS and SES
  • Plus tier has no free tier, and advanced security needs it or an add-on
  • Federated SAML and OIDC users have only 50 free MAUs
  • Best suited to teams already building on AWS

AWS Serverless Application Model (AWS SAM)

  • Targets AWS only, so templates are not portable to other cloud providers
  • Local testing of functions depends on Docker being installed and running
  • Requires an AWS account, the AWS CLI and configured credentials before first use
  • Declarative templates, so complex logic needs CloudFormation or the AWS CDK instead
  • Does not cover non-serverless infrastructure on its own, which falls back to CloudFormation

How much do Amazon Cognito and AWS Serverless Application Model (AWS SAM) cost?

Amazon Cognito has a free plan, with paid plans from $0.015/mo; AWS Serverless Application Model (AWS SAM) is free to use. Plan by plan below, from each vendor's own pricing page.

Amazon Cognito

Free
  • Essentials$0.015
    • Managed Login
    • Passwordless sign-in
    • 10,000 free MAUs
  • Plus$0.02
    • Threat protection
    • Adaptive authentication
    • No free tier

AWS Serverless Application Model (AWS SAM)

Free

No published plan breakdown. See the AWS Serverless Application Model (AWS SAM) review.

Which should you pick?

Choose Amazon Cognito if

  • You need user pools with sign-up and sign-in.
  • You want to start without paying.
  • You also want social, saml and oidc federation.

Choose AWS Serverless Application Model (AWS SAM) if

  • You need sam template shorthand for cloudformation.
  • You want to start without paying.
  • You work on Windows, macOS, Linux.
  • You also want sam cli project scaffolding with sam init.

Questions people ask

Is Amazon Cognito or AWS Serverless Application Model (AWS SAM) better?
It depends on the job. Amazon Cognito fits customer sign-in for AWS-hosted apps; AWS Serverless Application Model (AWS SAM) fits defining Lambda and API Gateway applications as code. Amazon Cognito starts at Free and AWS Serverless Application Model (AWS SAM) at Free.
Which is cheaper, Amazon Cognito or AWS Serverless Application Model (AWS SAM)?
Amazon Cognito starts at Free and AWS Serverless Application Model (AWS SAM) at Free.
Does Amazon Cognito or AWS Serverless Application Model (AWS SAM) run on more platforms?
Amazon Cognito runs on Web. AWS Serverless Application Model (AWS SAM) runs on Windows, macOS, Linux.
Can I use Amazon Cognito for free?
Both have a free tier, so you can try either at no cost before committing.
What is Amazon Cognito best used for?
Amazon Cognito is most often used for customer sign-in for aws-hosted apps, federating enterprise saml and oidc identity providers, machine-to-machine tokens for microservices, passwordless login with passkeys. Of those, customer sign-in for aws-hosted apps and federating enterprise saml and oidc identity providers are not what AWS Serverless Application Model (AWS SAM) is typically brought in for.
What can Amazon Cognito do that AWS Serverless Application Model (AWS SAM) cannot?
Amazon Cognito covers User pools with sign-up and sign-in, Social, SAML and OIDC federation, Passkeys and one-time passwords, OAuth 2.0 machine-to-machine tokens. AWS Serverless Application Model (AWS SAM) covers SAM template shorthand for CloudFormation, SAM CLI project scaffolding with sam init, Local testing of Lambda functions and API endpoints, sam sync for syncing local changes to the cloud.

Answered from the vendors’ own pages

Amazon Cognito: How much does Amazon Cognito cost?

Essentials is $0.015 per monthly active user and Plus is $0.020, after the free tier. Lite uses tiered pricing starting around $0.0055.

Source
AWS Serverless Application Model (AWS SAM): What is AWS SAM?

AWS SAM is an open-source framework for building serverless applications with infrastructure as code. It consists of a template syntax that extends CloudFormation and a command-line tool.

Source
Amazon Cognito: Is there a free tier?

Lite and Essentials include 10,000 free MAUs per account or AWS organisation. Plus has no free tier.

Source
AWS Serverless Application Model (AWS SAM): Which operating systems does the SAM CLI support?

AWS publishes installers for Linux on x86_64 and arm64, macOS on Intel and Apple silicon, and a 64-bit Windows MSI. macOS versions older than 13.x are not supported.

Source
Amazon Cognito: What sign-in methods are supported?

Passwords, social login, SAML and OIDC federation, and passwordless sign-in with passkeys or SMS and email one-time passwords.

Source
AWS Serverless Application Model (AWS SAM): What licence does AWS SAM use?

The serverless-application-model repository on GitHub is licensed under Apache-2.0.

Source
Amazon Cognito: Are SMS messages included?

No. SMS and email messages for verification and MFA are billed separately through Amazon SNS and Amazon SES.

Source
AWS Serverless Application Model (AWS SAM): How does SAM differ from the AWS CDK?

The documentation says to use SAM instead of the CDK if you prefer a declarative approach to describing infrastructure rather than a programmatic one. The two can also be combined, using the SAM CLI's local testing with CDK applications.

Source
Share

Related pages

Other head to heads