Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
@arc-iac/tf-cdk-spa
Advanced tools
Easily deploy your Single-Page Application to Amazon Web Services (AWS) S3 and CloudFront using the Cloud Development Kit for Terraform (CDKTF) with TypeScript. This package streamlines the process by utilizing the Cloud Development Kit (CDK) to define AW
Easily deploy your Single-Page Application to Amazon Web Services (AWS) S3 and CloudFront using the Cloud Development Kit for Terraform (CDKTF) with TypeScript. This package streamlines the process by utilizing the Cloud Development Kit (CDK) to define AWS resources.
Before you begin, ensure you have the following prerequisites in place:
npm install @arc-iac/tf-cdk-spa
The deployment process relies on several environment variables. Create a .env
file in the project's root directory and set the following variables:
Environment Variable | Default Value | Description |
---|---|---|
AWS_REGION | us-east-1 | AWS region for deployment |
AWS_PROFILE | default | AWS profile for authentication and authorization |
S3_BUCKET_NAME | N/A | S3 bucket name for storing SPA files |
CUSTOM_DOMAIN | N/A | Custom domain for the SPA |
HOSTED_ZONE_ID | N/A | Route 53 hosted zone ID for the custom domain |
RELATIVE_PATH_TO_BUILD_DIR | ../build | Relative path to the SPA build directory |
If any variables are not provided, the default values mentioned above will be used.
The following example demonstrates how to deploy an SPA using this package:
npm install @arc-iac/tf-cdk-spa
.main.ts
file.import { CloudFrontStaticWebsiteStack } from "@arc-iac/tf-cdk-spa";
import { App } from "cdktf";
const app = new App();
new CloudFrontStaticWebsiteStack(app, "spa-host"); // You can change the stack name ("spa-host") as needed.
app.synth();
.env
.npx cdktf deploy spa-host
This command leverages Terraform and CDK to create AWS resources based on the code in main.ts
. The deployment might take a few minutes.
Note: If you have multiple stacks or custom stack names, use cdktf deploy <stack-name>
.
After successful deployment, access your SPA through the custom domain specified in CUSTOM_DOMAIN
. Keep in mind that CloudFront might take some time to fully activate. If you encounter an AccessDenied
error, it's likely due to ongoing CloudFront provisioning. Wait about 15-20 minutes before accessing your resources.
To remove deployed resources from AWS, run:
npx cdktf destroy spa-host
Use this command to destroy infrastructure created during deployment. Confirm the destruction when prompted. Replace spa-host
with your stack names if customized.
This code is licensed under the MPL-2.0 license.
FAQs
Simplify the deployment of your static websites and Single-Page Applications (SPAs) to Amazon Web Services (AWS) S3 and CloudFront using the Cloud Development Kit for Terraform (CDKTF) with TypeScript. This package leverages the power of the Cloud Develop
The npm package @arc-iac/tf-cdk-spa receives a total of 2 weekly downloads. As such, @arc-iac/tf-cdk-spa popularity was classified as not popular.
We found that @arc-iac/tf-cdk-spa demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.