Skip to content

Instantly share code, notes, and snippets.

@markhu
Last active October 29, 2018 20:40
Show Gist options
  • Save markhu/c3f3c364f75dfa3aa870b4f0de206d46 to your computer and use it in GitHub Desktop.
Save markhu/c3f3c364f75dfa3aa870b4f0de206d46 to your computer and use it in GitHub Desktop.
test MarkDown formatting options for semi-complex document...

Excerpt from https://github.com/dwyl/learn-aws-lambda#hello-world-example-zip

  1. Zip up this file by typing the following into the command line. The command consists of the first filename which is the zip file you want to create (call it whatever you like .zip) followed by the files you want to zip up. In our example you can see the name of the .js file we created earlier:

        $ zip -r hello-world.zip hello-world.js

        You should now be able to see a .ZIP file alongside your .js file.
        NOTE: If your function has any dependencies then you must include your node_modules file within your .ZIP file. Simply add node_modules after the files you wish to zip up!


Later...

  1. numbered list
    • bullet under a number
    • more bullets
    • alternate bullet styles (all rendered the same)
  2. number continues...
  3. Configure your API endpoint settings:
    • API endpoint type : API Gateway
    • API name : whatever-you-like (we recommend having all lower case letters separated by a dash for readability)
    • Resource name: /YourLambdaFunctionName
    • Method : GET/POST/PUT/DELETE...
    • Deployment stage : Defines the path through which an API deployment is accessible
    • Security : Defines how your function can be invoked
      • The path will be a URI ending in >> .../deploymentStage/ResourceName

Deploy your Lambda functions using the deployment module we wrote - npm dpl

We decided to write dpl to make deploying your Lambda functions extremely easy. Here's how to implement it.

  1. $ npm install dpl --save-dev

  2. Configure your environment variables. You need AWS_REGION and AWS_IAM_ROLE

    export AWS_REGION=eu-west-1
    export AWS_IAM_ROLE=arn:aws:iam::123456789:role/LambdaExecRole
    
  3. Add the list of files to deploy to your package.json:

    "files_to_deploy": [ "package.json", "index.js", "lib/" ]
  4. Add the deployment script to your package.json

    "scripts": {
        "deploy": "dpl"
    }
  5. Run the script

    $ npm run deploy
    

  1. experiment: four spaces preceded this line. MD wraps it to previous line if no intervening blank line

    code as child of bullet (previous line is four-space-prefixed-triple-backticks)
    

    follow-up paragraph text under bullet/number

    also child--indents it if preceded by blank-line-preceded-by-indent

  2. bullet 2

    child text on its own line

    i.e. when in bullet mode, a line prefxed by 4-spaces is a child, not code/pre

    code indented by previous line prefixed by four-space-prefixed-triple-backticks
    

    more child text

  3. bullet 3

@markhu
Copy link
Author

markhu commented Oct 29, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment