Skip to content

Commit

Permalink
Initial README
Browse files Browse the repository at this point in the history
  • Loading branch information
ssennettau committed Feb 24, 2024
1 parent a9905c3 commit 8910c0f
Showing 1 changed file with 46 additions and 1 deletion.
47 changes: 46 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,46 @@
# replace this
# CloudFrontRedirector-Construct

CDK Construct to simplify using CloudFront to redirect entire domains or back-half stubs.

## Concept

Needs to redirect domains or building custom link shorteners is a common pattern required by many different solutions. This project simplifies using Amazon CloudFront with CloudFront Functions to rewrite the requests, forwarding users to another location.

<<< TODO: diagram >>>

## Usage

<<< TODO: Features >>>

### Installation
Before using this construct, you will need to import it for use in your AWS CDK stack.

```bash
# CDK for Typescript
npm install @ssennettau/cdk-cloudfront-redirector
```

### Integrating

```typescript
import * as cdk from 'aws-cdk-lib';
import { Construct } from 'constructs';
import { RedirectionSite } from 'cdk-cloudfront-redirector';

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

const redirect = new RedirectionSite(this, "RedirectionForWebsite", {
targetUrl: "https://ssennett.net/",
});

// Return outputs
new cdk.CfnOutput(this, "RedirectionUrl", { value: redirect.cfDistributionUrl })
}
}
```

## License

All code in this project is licensed under the [MIT License](LICENSE).

0 comments on commit 8910c0f

Please sign in to comment.