From 26a71b2b9305450c4595a0c05d10d0aab1d778d2 Mon Sep 17 00:00:00 2001 From: Aimee Ukasick Date: Mon, 27 Nov 2023 16:53:51 -0600 Subject: [PATCH] add v2 function zip --- .../lambda/files/just-sweet-potatoes-v2.zip | Bin 0 -> 952 bytes content/en/get-started/lambda/index.md | 44 +++++++++++++++++- 2 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 content/en/get-started/lambda/files/just-sweet-potatoes-v2.zip diff --git a/content/en/get-started/lambda/files/just-sweet-potatoes-v2.zip b/content/en/get-started/lambda/files/just-sweet-potatoes-v2.zip new file mode 100644 index 0000000000000000000000000000000000000000..14c7891314f1773357806ec95608656540e3042d GIT binary patch literal 952 zcmWIWW@Zs#0D(JYrQu)(ln`N1V8|*hF3~M6Pfab+EyyoPEXhwT)(;KgWnfp7j7^2% z(h6<{MwYLP3=CkC0>CD6FmNzTKr+#ig@Hi^hl!baDXA5DS;b(JCrZSoasf>T(P$>u z2K#2;b`aS6I-JMy=244fUqmK5aco&W&FNC`iA3GrB}Z4wZrnUc+v|Vz{Szyt?;K-K ze*5Ok?C*-Ae-=-lQhIk+1gl?(x8L%JOHJ;5m7d$>U#2^j)cVf1oV>Wj?xhERPqO~a z)P=XE?pzSG=-Kq&{wo+>RmewN<@)vI=+m-T_K90&$oHS^R^4lzAIsk7n>YRZ?L`}& z-WU3=XZUoQ=EiR~jxL|7pRQxFYKeo?mpH9`3%}1kdn(I%<+9n~PXhj=Ug-Qh;Spz2 zbi`MV>SG)){M$;te(Y+OMipj4xR`M_NT-&cr*R52&Kl7?y+A7tB z&U;<5Zn9bwnr_}xm2>mKhslD8H8*lHN=_DkyTKA+dtcXiOu2 z>bC#EM#(1c<@44y`fPcuuyG^X;WsL-{mH^Az8*V2C+^y?=qqoD+p52Pm%FUCZ% zz0wh~`PC`&HIj$!AJANye0W7o>|w5oP_AvSxsDp~OjYDc%BgVuJKF`o06c zk7T-6P6}vb>b+A?X8pwbw?=!$BJ1);Uqu7AmhiVX_n&*TIWi*c&r1IwUR9xA=E4)U zpL>6C_Er8Bo8pwh()&y_stkX2oG)14EAN~BbgOIlhw5dQRu*mAUO4Uc@9mC-wmaYD zzdGh7n`5h~_Iq34bjC)<&o1S%>hZf)97~yZf_-6!rtlQYscS3y9zN#&u;(vtfHynG zT-yoDq?i~OKq)Q2n~_O`8F#vdrSrFrAQpM49AX13og>>0O6M@Jq%jDG4aBDU0B=?{ RkZDXncm_yc1NxDH0RZqTW=Q}5 literal 0 HcmV?d00001 diff --git a/content/en/get-started/lambda/index.md b/content/en/get-started/lambda/index.md index 31aaaffe..35e215bd 100644 --- a/content/en/get-started/lambda/index.md +++ b/content/en/get-started/lambda/index.md @@ -392,8 +392,45 @@ targets: - staging {{< /highlight >}} +## Upload function v2 -#### Create an AWS Lambda alias +1. Download the function v2 zip file. +1. Rename the zip file to `just-sweet-potatoes.zip`. +1. Upload the file to each of your `armory-demo-lambda-deploy` S3 buckets, overwriting the existing `just-sweet-potatoes.zip` file. + +
Expand to see the v2 code + +```js + +exports.handler = async (event) => { + // Get a random sweet potato fact + const randomFact = potatolessFacts[Math.floor(Math.random() * potatolessFacts.length)]; + + // Prepare the response + const response = { + statusCode: 200, + body: randomFact, + }; + + return response; +}; + +const potatolessFacts = [ + "Sweet potatoes are a great source of vitamin A, which is important for vision health.", + "There are over 400 varieties of sweet potatoes around the world.", + "Sweet potatoes are not related to regular potatoes; they belong to the morning glory family.", + "Sweet potatoes are high in fiber, making them good for digestion.", + "Sweet potatoes come in different colors, including orange, purple, and white.", + "Sweet potatoes are one of the oldest vegetables known to man.", + "North Carolina is the largest producer of sweet potatoes in the United States.", + "Sweet potatoes are often used in Thanksgiving dishes like casseroles and pies.", + "Sweet potatoes and yams are not the same vegetable even though many Americans use the two names interchangeably.", + ]; +``` + +
+ +## Create an AWS Lambda alias CD-as-a-Service uses an AWS Lambda [alias](https://docs.aws.amazon.com/lambda/latest/dg/configuration-aliases.html) when routing traffic between old and new versions of your function. Before you can use use the `trafficSplit` strategy, create an AWS Lambda alias for the functions you deployed to `prod-west-1` and `prod-west-2`. @@ -404,7 +441,7 @@ In your AWS Lambda console, make sure you are in region `us-west-1`. Access the Repeat for the `just-sweet-potatoes-prod-west-2` function. -#### Add traffic management info +## Add traffic management configuration Now that you've created aliases, you need to declare those in a new `trafficManagement` section so CD-as-a-Service can perform the traffic split strategy. Add the following top-level section to your deployment config file: @@ -421,6 +458,9 @@ trafficManagement: {{< /highlight >}} + + + ## Deploy your function for a second time Start your second deployment using the CLI: