Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

awscdk-construct-file-publisher

Package Overview
Dependencies
Maintainers
0
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

awscdk-construct-file-publisher

AWS CDK Construct to upload local files to S3 and make them publicly available via CloudFront

  • 0.0.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

awscdk-construct-file-publisher

View on Construct Hub

CDK Construct for making local files publicly available

  • Specify a path to a local folder that contains files
  • FilePublisher creates an S3 bucket and uploads all the files to the bucket
  • FilePublisher creates a CloudFront distribution and set the bucket as its origin via Origin Access Identity (OAI)
  • You can access the files via CloudFront as the S3 bucket remains private

Install

NPM

Usage

import * as cdk from 'aws-cdk-lib';
import { Construct } from 'constructs';
import { FilePublisher } from 'awscdk-construct-file-publisher';

export class ExampleStack extends cdk.Stack {
  constructor(scope: Construct, id: string, props?: cdk.StackProps) {
    super(scope, id, props);

    // Upload all the files in the local folder (./upload) to S3
    const publicFolder = new FilePublisher(this, 'FilePublisher', {
      path: './upload',
    });

    // You can access the file via Internet
    new cdk.CfnOutput(this, "PublicURL", {
      value: `${publicFolder.url}/dog.mp4`,,
      exportName: cdk.Aws.STACK_NAME + "PublicURL",
      description: "Public URL",
    });
  }
}

Keywords

FAQs

Package last updated on 01 Sep 2024

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc