Skip to content

Commit 6f535ed

Browse files
completed serverless variables
1 parent a5bd977 commit 6f535ed

File tree

5 files changed

+21
-6
lines changed

5 files changed

+21
-6
lines changed

content/_index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
+++
2-
description = "A compilation of notes during my journey from novice to full stack JavaScript developer by Russell Rosario."
2+
description = "Helping junior developers navigate the complex world of software engineering without information overload"
33
title = "JavaScripter"
44
draft = false
55

content/devops/scalability.md

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ script = 'animation'
8181
<li>vendor agnostic (AWS, Azure, Google Cloud, etc)</li>
8282
<li>language independent (Node, Java, Python, etc)</li>
8383
<li>packages functions AND provisions resources</li>
84-
<li>large community that builds excellent plugins</li>
84+
<li>large community that builds excellent <ins>plugins</ins></li>
8585
</ul>
8686
</dd>
8787
<dd><b>Infrastructure as code (IaC)</b> - The process of managing and provisioning computer data centers through definition files.
@@ -97,9 +97,24 @@ script = 'animation'
9797
<dd><b>Functions</b> - A property of the serverless.yml which lists the names of the function in your service. Inside the function is a handler pointing to the code. Functions can be nested inside other functions. Environment variables can be set as well as tagging. If the function fails, a DLQ (SNS) can be published.</dd>
9898
<dd><b>Events</b> - things that trigger your functions to run (an S3 bucket upload, an SNS topic, and HTTP endpoints created via API Gateway)</dd>
9999
<dd><b>Layers</b> - Code that you've used else where that you can import into the serverless function.</dd>
100-
<dd><b>Resources</b> - A property of the serverless.yml which defines the infrastructure your functions depend on, like AWS DynamoDB or AWS S3. Resources deployed by Serverless have the naming scheme - <mark>{Function Name}{Cloud Formation Resource Type}{Resource Name}{SequentialID or Random String}</mark> (does not include S3). You can reference any resource by using the logical name or ARN.
100+
<dd><b>Resources</b> - A property of the serverless.yml which defines the infrastructure your functions depend on, like AWS DynamoDB or AWS S3. Resources deployed by Serverless have the naming scheme - <var>{Function Name}{Cloud Formation Resource Type}{Resource Name}{SequentialID or Random String}</var>. <i>Does not apply to S3</i>.
101101
</dd>
102-
<dd><b>Variables</b> - allow users to dynamically replace config values in serverless.yml config.</dd><br/>
102+
<dd><b>Variables</b> - allow users to dynamically replace config values in serverless.yml config with <mark>${}</mark> notation.
103+
<ul>
104+
<li><b>Self reference</b> - <var>${self:someProperty}</var></li>
105+
<li><b>Other files</b> - <var>${file(../myFile.json):someProperty}</var></li>
106+
<li><b>In JS files</b> - reference JavaScript files to add dynamic data into your variables. <var>${file(../myFile.js):someModule}</var></li>
107+
<li><b>Recursively reference properties</b> - <var>${file(../config.${self:provider.stage}.json):CREDS}</var></li>
108+
<li><b>Environment Variables</b> - <var>${env:SOME_VAR}</var>. <i>Keep in mind that sensitive information which is provided through environment variables can be written into less protected or publicly accessible build logs, CloudFormation templates, et cetera.</i></li>
109+
<li><b>Referencing CLI Options</b> -<var>${opt:some_option}</var>. A common CLI option is the dev stage.</li>
110+
<li><b>CloudFormation Outputs</b> - allows your service to communicate with other services/stacks using <var>${cf:stackName.outputKey}</var>. Output names are added to the <ins>Export</ins> field in the resources property:<br/>
111+
<img alt="Image" src="https://www.javascripter.co/img/devops/exporting_cf.PNG"><br/>
112+
<ins>Import</ins> into other services:
113+
<img alt="Image" src="https://www.javascripter.co/img/devops/importing_cf.PNG"><br/>
114+
</li>
115+
<li><b>S3 Objects</b> - <var>${s3:myBucket/myKey}-hello</var></li>
116+
</ul>
117+
</dd><br/>
103118
<dd>[Full documentation](https://serverless.com/framework/docs/providers/aws/guide/serverless.yml/)</dd>
104119
<dd>[Reference .yml](https://serverless.com/framework/docs/providers/aws/guide/serverless.yml/)</dd>
105120
</dl>

layouts/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ <h1>{{.Title}}</h1>
1515
<p>Zip-archive of all notes indexed in README.md</p>
1616
</div>
1717
<div class="message focus" style="text-align:center" data-component="message"> <span class="close small"></span>
18-
Created by <a class="button inverted small " href="https://www.russellrosario.com">Russell Rosario </a> and
19-
made public for other junior developers. <mark>Contributions Welcome!</mark>
18+
A compilation of notes during my journey from novice to full stack JavaScript developer by <a class="button inverted small "
19+
href="https://www.russellrosario.com">Russell Rosario</a>
2020
</div>
2121
<div id="kube-features">
2222
<div class="row gutters">

static/img/devops/exporting_cf.PNG

9.83 KB
Loading

static/img/devops/importing_cf.PNG

4.47 KB
Loading

0 commit comments

Comments
 (0)