# @bamapookie/serverless-pseudo-parameters-lite

> Serverless AWS Pseudo Parameters --------------------------------

Latest version **0.0.4** (published 2018-01-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install @bamapookie/serverless-pseudo-parameters-lite
pnpm add @bamapookie/serverless-pseudo-parameters-lite
yarn add @bamapookie/serverless-pseudo-parameters-lite
bun add @bamapookie/serverless-pseudo-parameters-lite
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.4 |
| Published | 2018-01-02 |
| First published | 2017-12-31 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | bamapookie |

## Links

- npm: https://www.npmjs.com/package/@bamapookie/serverless-pseudo-parameters-lite
- npm.io page: https://npm.io/package/@bamapookie/serverless-pseudo-parameters-lite

## Recent versions

- 0.0.4 (latest) — 2018-01-02
- 0.0.3 — 2018-01-02
- 0.0.2 — 2018-01-02
- 0.0.1 — 2017-12-31

## README

Serverless AWS Pseudo Parameters
--------------------------------

Currently, it's impossible (or at least, very hard) to use the [CloudFormation Pseudo Parameters](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/pseudo-parameter-reference.html) in your `serverless.yml`.

This plugin fixes that.

You can now use `#{AWS::AccountId}`, `#{AWS::Region}`, etc. in any of your config strings, and this plugin replaces those values with the proper pseudo parameter `Fn::Sub` CloudFormation function.

Note: This is a refactored implementation of the very fine [Serverless Pseudo Parameters](https://github.com/svdgraaf/serverless-pseudo-parameters) plugin by [Sander van de Graaf](https://github.com/svdgraaf) that inlines and removes all npm dependencies.

Installation
-----
Install the package with npm: `npm install serverless-pseudo-parameters-lite`, and add it to your `serverless.yml` plugins list:

```yaml
plugins:
  - '@bamapookie/serverless-pseudo-parameters-lite'
```

Usage
-----
Add one of the pseudo parameters to any resource parameter, and it will be replaced during deployment. Mind you to replace the default `${}` with a `#{}`. So `${AWS::AccountId}`, becomes: `#{AWS::AccountId}` etc.

For example, this configuration will create a bucket with your account id appended to the bucket name:

```yaml
service: users-bucket-thingy

plugins:
  - '@bamapookie/serverless-pseudo-parameters-lite'

functions:
  users:
    handler: users.handler
    events:
      - s3:
          bucket: photos-#{AWS::AccountId}
          event: s3:ObjectRemoved:*
```

The output in the cloudformation template will look something like this:

```json
{
  "Type": "AWS::S3::Bucket",
  "Properties": {
    "BucketName": {
      "Fn::Sub": "photos-${AWS::AccountId}"
    }
  }
}
```

Or use it to generate Arn's, for example for [Step Functions](https://www.npmjs.com/package/serverless-step-functions):

```yaml
service: foobar-handler

plugins:
  - '@bamapookie/serverless-pseudo-parameters-lite'

functions:
  foobar-baz:
    handler: foo.handler

stepFunctions:
  stateMachines:
    foobar:
      definition:
        Comment: "Foo!"
        StartAt: bar
        States:
          bar:
            Type: Task
            Resource: "arn:aws:lambda:#{AWS::Region}:#{AWS::AccountId}:function:${self:service}-${opt:stage}-foobar-baz"
            End: true
```

The plugin also automatically replace _hardcoded_ region in `serverless.yml`. This feature can be disabled using:

```yaml
custom:
    pseudoParameters:
        skipRegionReplace: true
```

---
_Source: https://npm.io/package/@bamapookie/serverless-pseudo-parameters-lite · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
