<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/create-a-serverless-url-shortener-in-aws-with-terraform-ygpbektoz" -->

---
title: Create a serverless URL shortener in AWS with Terraform
description: Learn how to create a serverless URL shortener in AWS using Terraform. The project architecture consists of API Gateway, Lambda Function, DynamoDB, and DAX...
canonical: https://daily.dev/posts/create-a-serverless-url-shortener-in-aws-with-terraform-ygpbektoz
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Create a serverless URL shortener in AWS with Terraform | daily.dev
og:description: Learn how to create a serverless URL shortener in AWS using Terraform. The project architecture consists of API Gateway, Lambda Function, DynamoDB, and DAX...
og:url: https://daily.dev/posts/create-a-serverless-url-shortener-in-aws-with-terraform-ygpbektoz
og:image: https://api.daily.dev/og/posts/YgpBEKtOz.png
og:image:alt: Create a serverless URL shortener in AWS with Terraform
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a serverless URL shortener in AWS with Terraform

**[gitconnected](https://daily.dev/sources/gc)** · 16 min read · 5 upvotes · 0 comments

## Summary

Learn how to create a serverless URL shortener in AWS using Terraform. The project architecture consists of API Gateway, Lambda Function, DynamoDB, and DAX (DynamoDB Accelerator). The application allows users to input a URL and receive a redirect URL with a short code attached. The infrastructure is managed using Terraform, making it easier to provision and modify services. The URL shortening functionality is implemented through a Lambda function that saves the URL in DynamoDB and generates a short URL code. When a user calls the short URL, the application checks the cache for the corresponding record and redirects the user to the original URL.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://levelup.gitconnected.com/create-a-serverless-url-shortener-in-aws-with-terraform-99fda5fecfd0>

---

Tags: [#aws](https://daily.dev/tags/aws), [#serverless](https://daily.dev/tags/serverless), [#terraform](https://daily.dev/tags/terraform), [#api-gateway](https://daily.dev/tags/api-gateway)

[View this post on daily.dev](https://daily.dev/posts/create-a-serverless-url-shortener-in-aws-with-terraform-ygpbektoz)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Create a serverless URL shortener in AWS with Terraform","url":"https://daily.dev/posts/create-a-serverless-url-shortener-in-aws-with-terraform-ygpbektoz","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/create-a-serverless-url-shortener-in-aws-with-terraform-ygpbektoz"},"datePublished":"2024-05-02T10:28:01.638Z","dateModified":"2024-05-09T08:16:28.624Z","description":"Learn how to create a serverless URL shortener in AWS using Terraform. The project architecture consists of API Gateway, Lambda Function, DynamoDB, and DAX...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/ff0830ce49dd6cafe42188e91c3df454?_a=AQAEuiZ","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/ff0830ce49dd6cafe42188e91c3df454?_a=AQAEuiZ","isAccessibleForFree":true,"articleSection":"gitconnected","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"gitconnected","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/gc","url":"https://daily.dev/sources/gc"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/create-a-serverless-url-shortener-in-aws-with-terraform-ygpbektoz","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":5},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"aws,serverless,terraform,api-gateway","timeRequired":"PT16M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"gitconnected","item":"https://daily.dev/sources/gc"},{"@type":"ListItem","position":3,"name":"Create a serverless URL shortener in AWS with Terraform"}]}
```

