# cloudfront-api-update

> Package that will update CloudFront Distribuions with API gateway endpoints as origins

Latest version **1.0.2** (published 2018-10-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install cloudfront-api-update
pnpm add cloudfront-api-update
yarn add cloudfront-api-update
bun add cloudfront-api-update
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2018-10-03 |
| First published | 2018-02-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 8.1 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | Keshav Kumaresan |
| Maintainers | prosperoware |
| Keywords | cloudfront |

## Links

- npm: https://www.npmjs.com/package/cloudfront-api-update
- Repository: https://github.com/Prosperoware/CloudFrontAPIOrigins
- Homepage: https://github.com/Prosperoware/CloudFrontAPIOrigins#readme
- Issues: https://github.com/Prosperoware/CloudFrontAPIOrigins/issues
- npm.io page: https://npm.io/package/cloudfront-api-update

## Dependencies (2)

- [aws-sdk](https://npm.io/package/aws-sdk.md) ^2.188.0
- [bluebird](https://npm.io/package/bluebird.md) ^3.5.1

## Recent versions

- 1.0.2 (latest) — 2018-10-03
- 1.0.1 — 2018-02-28
- 1.0.0 — 2018-02-02

## README

cloudfront-api-update
=================================
[![npm version](https://badge.fury.io/js/cloudfront-api-update.svg)](https://badge.fury.io/js/cloudfront-api-update)

## Features
This plugin can be used to update your CloudFront Distribution with API Gateway Origins and Cache Behaviors, so that the API gateway endpoints can be served through CloudFront.

## Install Plugin
`npm install --save cloudfront-api-update`

## Using the Plugin
1) Require the module in your script.

    `const cau = require("cloudfront-api-update")`;

2) Configure the required params. Note that `Origins` is an array, and there can be multiple Origins in the form of multiple objects.
```
const params = {
    "DistributionId": "DISTRIBUTION_ID",
    "Origins": [{
            "DomainName": "api-id.execute-api.region.amazonaws.com",
            "OriginPath": "",
            "PathPattern": "/v1/api/*"
        }
    ]
}
```
3) Run the `updateDistribution` method to update your CloudFront Distribution.

```
cau.updateDistribution(params.DistributionId, params.Origins)
    .then(results => {
        console.log(results);
    }).catch(error => {
        console.error(error);
    })
```

## Links
* [CloudFront Update Distribution Documentation](https://docs.aws.amazon.com/cloudfront/latest/APIReference/API_UpdateDistribution.html)


## License
[MIT](LICENSE)

---
_Source: https://npm.io/package/cloudfront-api-update · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
