{"id":22148156,"url":"https://github.com/arup-g/serverless-with-golang","last_synced_at":"2026-04-12T02:34:16.669Z","repository":{"id":264858276,"uuid":"894493165","full_name":"ARUP-G/Serverless-with-Golang","owner":"ARUP-G","description":"This repository contains a serverless application written in Golang, deployed on AWS. The application leverages AWS Lambda for serverless compute, DynamoDB for the database, and API Gateway for HTTP Endpoints. The architecture uses Amazon Linux 2 on amd64 architecture for the Lambda runtime.","archived":false,"fork":false,"pushed_at":"2025-03-16T14:23:51.000Z","size":16818,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-24T12:48:32.899Z","etag":null,"topics":["aws","aws-apigateway","aws-lambda","dynamodb","golang"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ARUP-G.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-26T13:01:35.000Z","updated_at":"2025-03-16T14:23:54.000Z","dependencies_parsed_at":"2025-01-07T11:31:22.490Z","dependency_job_id":"59a4eea6-480b-4524-bec7-f731b1092e85","html_url":"https://github.com/ARUP-G/Serverless-with-Golang","commit_stats":null,"previous_names":["arup-g/serverless-with-golang"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ARUP-G/Serverless-with-Golang","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ARUP-G%2FServerless-with-Golang","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ARUP-G%2FServerless-with-Golang/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ARUP-G%2FServerless-with-Golang/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ARUP-G%2FServerless-with-Golang/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ARUP-G","download_url":"https://codeload.github.com/ARUP-G/Serverless-with-Golang/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ARUP-G%2FServerless-with-Golang/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31702580,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-11T21:17:31.016Z","status":"online","status_checked_at":"2026-04-12T02:00:06.763Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws","aws-apigateway","aws-lambda","dynamodb","golang"],"created_at":"2024-12-01T23:26:10.807Z","updated_at":"2026-04-12T02:34:16.653Z","avatar_url":"https://github.com/ARUP-G.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Serverless with Golang\n\nThis serverless application (REST API) is built using **Golang** to leverage its efficiency and concurrency features, providing a highly scalable and reliable backend service. It follows the serverless architecture paradigm by utilizing **AWS Lambda** for compute, **Amazon DynamoDB** for persistent data storage, and Amazon **API Gateway** for request handling and routing.\n\nThis architecture ensures cost-effectiveness by eliminating the need for dedicated servers while maintaining scalability and high availability, making it ideal for modern cloud-native applications.\n\n---\n\n## Features\n\n- **Serverless Architecture**: Powered by AWS Lambda and API Gateway.\n- **Database**: DynamoDB for efficient, scalable storage.\n- **Written in Go**: Leveraging Go's speed and efficiency.\n\n---\n\n## Prerequisites\n\nEnsure you have the following installed:\n\n1. **Go** (Golang):\n   - Install Go from [Go Official Website](https://golang.org/dl/).\n\n---\n\n## Project Structure\n\n```plaintext\nServerless-with-Golang/\n├───build\n|   └───deployment.zip\n├───cmd\n|   ├───main.go\n│   └───bootstrap\n├───pkg\n│   ├───handlers\n│   ├───user\n│   └───validators\n├── README.md\n├── go.sum\n└── go.mod\n```\n\n## Steps to Deploy the Application\n\n1. **Clone the Repository**\n   ```bash\n   git clone https://github.com/ARUP-G/Serverless-with-Golang.git\n   cd Serverless-with-Golang\n   ```\n\n2. **Build the Go Application**\n   ```bash\n   # For Linux user\n   GOOS=linux GOARCH=amd64 go build -o bootstrap cmd/main.go\n   #For windows user\n   $env:GOOS=\"linux\"; $env:GOARCH=\"amd64\"; go build -o bootstarp cmd/main.go\n   # This builds the Go application compatible with AWS Lambda's environment.\n   ```\n\n3. **Setup Using AWS Console**\n\n   1. **Create a DynamoDB Table**\n      - Go to the DynamoDB Console: [DynamoDB Console](https://console.aws.amazon.com/dynamodb).\n      - Click **Create table**.\n      - Provide the following details:\n        - **Table Name**: go-serverless-tb (or a name of your choice, change it in the main.go)\n        - **Partition Key**: email (String)\n      - Select **On-demand capacity mode (Pay-per-request)** for flexibility.\n      - Click **Create table**.\n      ![DBTAble](image/db.png)\n\n   2. **Create a Lambda Function**\n      - Go to the Lambda Console: [Lambda Console](https://console.aws.amazon.com/lambda).\n      - Click **Create function**.\n      - Select **Author from scratch**.\n      - Provide the following details:\n        - **Function name**: go-serverless-app\n        - **Runtime**: Amazon Linux \n        - **Architecture**: x86_64\n      - Under **Permissions**, create a new role with basic Lambda permissions.\n      - Click **Create function**.\n      ![Lamda func](image/lambda.png)\n\n   3. **Upload the Code**\n      - Scroll to the **Code source** section.\n      - Click **Upload from** and select **.zip file**.\n      - Prepare your .zip file by building your Go application:\n        ```bash\n        zip deployment.zip bootstrap\n        ```\n      - Upload the `deployment.zip` file and click **Save**.\n      ![Deployment](image/zip.png)\n\n   4. **Add Environment Variables (Optional)**\n      - Scroll to the **Configuration** tab and click **Environment variables**.\n      - Add variables such as `TABLE_NAME` for your DynamoDB table name.\n\n   5. **Grant Lambda Access to DynamoDB**\n      - In the Lambda Console, go to the **Configuration** tab.\n      - Click **Permissions** and then click the role name under **Execution role**.\n      - Attach the `AmazonDynamoDBFullAccess` policy:\n        - Click **Add permissions** → **Attach policies**.\n        - Search for `AmazonDynamoDBFullAccess` and click **Attach policy**.\n\n   6. **Create an API Gateway**\n      - Go to the API Gateway Console: [API Gateway Console](https://console.aws.amazon.com/apigateway).\n      - Click **Create API** and choose **REST API**.\n      - Select **Build**.\n      - Under **Configure routes**, add the following route:\n        - **Method**: ANY\n        - **Resource path**: /items/{proxy+}\n      - Select **Integration** and choose **Lambda function**.\n      - Enter your Lambda function name (go-serverless-app).\n      - Click **Create**.\n      - Deploy the API:\n        - Click **Deployments** under your API name.\n        - Select **Create** and provide a stage name (e.g., prod).\n        - Click **Deploy**.\n      ![api-gateway](image/api-gate.png)\n\n4. **Test the Setup**\n\n   1. **Test via API Gateway**\n      - Copy the Invoke URL from the **Stages** section of your API Gateway.\n      - Test the endpoint using curl or Postman:\n        ```bash\n        curl -X POST -H \"Content-Type: application/json\" -d '{\"email\": \"test@example.com\",\"firstName\": \"Kernel\", \"lastName\": \"Dev\"}' https://\u003cAPI_ID\u003e.execute-api.\u003cREGION\u003e.amazonaws.com/prod/items\n        ```\n\n   2. **Check DynamoDB**\n      - Go to the DynamoDB Console → Tables → Your Table.\n      - Click **Explore table items** to verify the data.\n\n5. **Cleanup Resources**\n\n   To avoid unnecessary charges, delete the resources when they are no longer needed:\n\n   - **Lambda Function**:\n     - Go to the Lambda Console, select the function, and click **Delete**.\n   - **DynamoDB Table**:\n     - Go to the DynamoDB Console, select the table, and click **Delete table**.\n   - **API Gateway**:\n     - Go to the API Gateway Console, select the API, and click **Delete API**.\n## 🛠️ Contributing\nContributions are welcome! Please submit a PR or open an issue.\n\n## 📜 License\nThis project is licensed under the **MIT License**.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farup-g%2Fserverless-with-golang","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farup-g%2Fserverless-with-golang","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farup-g%2Fserverless-with-golang/lists"}