{"id":16741946,"url":"https://github.com/cnunciato/pulumi-jamstack-aws","last_synced_at":"2026-04-13T00:35:44.318Z","repository":{"id":57102815,"uuid":"385374584","full_name":"cnunciato/pulumi-jamstack-aws","owner":"cnunciato","description":"A Pulumi component for managing Jamstack static websites on AWS.","archived":false,"fork":false,"pushed_at":"2021-07-24T17:35:02.000Z","size":380,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-23T05:16:49.774Z","etag":null,"topics":["aws","jamstack","pulumi","serverless","static-website"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cnunciato.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-07-12T20:26:26.000Z","updated_at":"2021-12-31T15:05:39.000Z","dependencies_parsed_at":"2022-08-21T00:31:22.421Z","dependency_job_id":null,"html_url":"https://github.com/cnunciato/pulumi-jamstack-aws","commit_stats":null,"previous_names":[],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cnunciato%2Fpulumi-jamstack-aws","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cnunciato%2Fpulumi-jamstack-aws/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cnunciato%2Fpulumi-jamstack-aws/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cnunciato%2Fpulumi-jamstack-aws/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cnunciato","download_url":"https://codeload.github.com/cnunciato/pulumi-jamstack-aws/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243806032,"owners_count":20350773,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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","jamstack","pulumi","serverless","static-website"],"created_at":"2024-10-13T01:06:35.630Z","updated_at":"2026-04-13T00:35:44.288Z","avatar_url":"https://github.com/cnunciato.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pulumi-jamstack-aws\n\nA [Pulumi](https://pulumi.io/) component for managing JAMstack websites on AWS. ([What's a JAMstack](https://jamstack.wtf/)?)\n\n## Why do I need this component?\n\nMaking static websites is easy, but deploying them \u0026mdash; into the cloud, on your own \u0026mdash; is hard. This component aims to make that whole process a little less painful.\n\n## What does it do?\n\nGiven a folder containing a static website, an optional domain name, and an optional set of URL routes and accompanying functions, the component deploys the website on Amazon S3, gives it a domain name with Route 53, distributes it globally with CloudFront (including SSL/TLS), and deploys the functions as a set of serverless endpoints with AWS API Gateway.\n\n## Using the component\n\n### Step 0: Install Pulumi\n\nIf you haven't already, install Pulumi with your package manager of choice.\n\n```\n$ brew install pulumi\n```\n\n### Step 1. Make a static website\n\nIf you don't already have a folder containing a static website, create an empty folder, then put a static website into it. The following snippet creates a new React app, runs an initial build, and places the built website into the `build` folder.\n\n```\n$ npx create-react-app site\n$ cd site\n$ npm run build\n$ cd ..\n```\n\nAt this point, you'll have just the `site` folder containing your static-website source and build:\n\n```\n$ ls\nsite\n\n$ ls site/build\n... index.html ...\n```\n\n### Step 2. Create a Pulumi project and stack\n\nMake a new folder alongside the `site` folder for the Pulumi project and stack, change to that folder, and run the new-project wizard, following the prompts:\n\n```\n$ mkdir infra \u0026\u0026 cd infra\n$ pulumi new aws-typescript\n```\n### Step 3. Install this component from npm ✨\n\nStill in the `infra` folder, [install this component](https://www.npmjs.com/package/@cnunciato/pulumi-jamstack-aws):\n\n```\n$ npm install --save @cnunciato/pulumi-jamstack-aws\n```\n\n### Step 4. Declare a website\n\nReplace the contents of `infra/index.ts` with the following program (for example), which deploys the `../site/build` folder as a static website on Amazon S3, distributes it globally with a CloudFront CDN, uses a custom domain name (via Route 53) with SSL/TLS, and adds a single serverless API endpoint using AWS Lambda:\n\n```typescript\nimport { Website } from \"@cnunciato/pulumi-jamstack-aws\";\n\nconst site = new Website(\"my-site\", {\n    protocol: \"https\",\n\n    site: {\n        path: \"../site/build\",\n    },\n\n    domain: {\n        name: \"nunciato.org\",\n        host: \"site-dev\",\n    },\n\n    cdn: {\n        cacheTTL: 10 * 60,\n        logs: true,\n    },\n\n    api: {\n        prefix: \"api\",\n        routes: [\n            {\n                method: \"GET\",\n                path: \"/hello/{name}\",\n                eventHandler: async (event: any) =\u003e {\n                    return {\n                        statusCode: 200,\n                        body: JSON.stringify({\n                            message: `Hello, ${event.pathParameters?.name}!`,\n                        }),\n                    };\n                },\n            },\n        ],\n    },\n});\n\nexport const {\n    bucketName,\n    bucketWebsiteURL,\n    cdnDomainName,\n    cdnURL,\n    apiGatewayURL,\n    websiteURL,\n    websiteLogsBucketName,\n} = site;\n```\n\n### Step 5. Deploy!\n\nLaunch the website.\n\n```\n$ pulumi up\n\nPreviewing update (dev)\n...\n\nUpdating (dev)\n\nView Live: https://app.christian.pulumi-dev.io/cnunciato/pulumi-jamstack-aws-test-npm-infra/dev/updates/1\n\n     Type                                       Name                                    Status      Info\n +   pulumi:pulumi:Stack                        pulumi-jamstack-aws-test-npm-infra-dev  created     1 warning; 2 messages\n +   └─ pulumi-s3-static-website:index:Website  my-site                                 created\n +      ├─ aws:apigateway:x:API                 website-api                             created\n +      │  ├─ aws:iam:Role                      website-api6ec0544c                     created\n +      │  ├─ aws:lambda:Function               website-api6ec0544c                     created\n +      │  ├─ aws:iam:RolePolicyAttachment      website-api6ec0544c-4aaabb8e            created\n +      │  ├─ aws:iam:RolePolicyAttachment      website-api6ec0544c-74d12784            created\n +      │  ├─ aws:iam:RolePolicyAttachment      website-api6ec0544c-a1de8170            created\n +      │  ├─ aws:iam:RolePolicyAttachment      website-api6ec0544c-b5aeb6b6            created\n +      │  ├─ aws:iam:RolePolicyAttachment      website-api6ec0544c-6c156834            created\n +      │  ├─ aws:iam:RolePolicyAttachment      website-api6ec0544c-7cd09230            created\n +      │  ├─ aws:iam:RolePolicyAttachment      website-api6ec0544c-e1a3786d            created\n +      │  ├─ aws:iam:RolePolicyAttachment      website-api6ec0544c-019020e7            created\n +      │  ├─ aws:iam:RolePolicyAttachment      website-api6ec0544c-1b4caae3            created\n +      │  ├─ aws:apigateway:RestApi            website-api                             created\n +      │  ├─ aws:apigateway:Deployment         website-api                             created\n +      │  ├─ aws:lambda:Permission             website-api-c4bbce9d                    created\n +      │  └─ aws:apigateway:Stage              website-api                             created\n +      ├─ pulumi:providers:aws                 website-cert-provider                   created\n +      ├─ aws:s3:Bucket                        website-logs-bucket                     created\n +      ├─ aws:s3:Bucket                        website-bucket                          created\n +      ├─ aws:acm:Certificate                  website-cert                            created\n +      ├─ aws:route53:Record                   website-cert-validation-record          created\n +      ├─ aws:cloudfront:Distribution          website-cdn                             created\n +      ├─ aws:acm:CertificateValidation        website-cert-validation                 created\n +      └─ aws:route53:Record                   site-dev.nunciato.org                   created\n\nDiagnostics:\n  pulumi:pulumi:Stack (pulumi-jamstack-aws-test-npm-infra-dev):\n    warning: Default document \"404.html\" does not exist.\n    Uploading 19 files from ../site/build...\n    Uploaded 19 files.\n\nOutputs:\n    apiGatewayURL        : \"https://u7kqxfecol.execute-api.us-west-2.amazonaws.com/api/\"\n    bucketName           : \"website-bucket-bf3bb7b\"\n    bucketWebsiteURL     : \"http://website-bucket-bf3bb7b.s3-website-us-west-2.amazonaws.com\"\n    cdnDomainName        : \"d2kgpg37ae61cs.cloudfront.net\"\n    cdnURL               : \"https://d2kgpg37ae61cs.cloudfront.net\"\n    websiteLogsBucketName: \"website-logs-bucket-cdddca9\"\n    websiteURL           : \"https://site-dev.nunciato.org\"\n\nResources:\n    + 26 created\n\nDuration: 4m8s\n```\n\n### Step 6. Browse to the website and query the API endpoint\n\n```\n$ open $(pulumi stack output websiteURL)\n```\n\n![image](https://user-images.githubusercontent.com/274700/126080824-4cf49b45-4c93-4897-9c0f-e881acf3d4c0.png)\n\n```\n$ curl -v $(pulumi stack output websiteURL)/api/hello/chris\n{\"message\":\"Hello, chris!\"}\n```\n\n### Step 7. (Optional) Tear it all down\n\n```\n$ pulumi destroy -y\n\n...\nDestroying (dev)\n\n...\n\nResources:\n    - 26 deleted\n\nDuration: 4m12s\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcnunciato%2Fpulumi-jamstack-aws","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcnunciato%2Fpulumi-jamstack-aws","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcnunciato%2Fpulumi-jamstack-aws/lists"}