From af027749c0c6270c5ee41c2ba1c8343a7f350bf6 Mon Sep 17 00:00:00 2001 From: aimee Date: Wed, 6 Dec 2023 15:17:23 -0600 Subject: [PATCH] docs(lambda): update for alias creation (#97) CDAAS-3107 --- assets/scss/_variables_project.scss | 13 +++++++++++++ content/en/deployment/lambda/overview/index.md | 7 +++++-- .../includes/code/lambda-traffic-split-snippet.yaml | 4 ++-- content/en/includes/lambda/alias-info.md | 7 +++++++ .../deployment/config-file/traffic-management.md | 6 +++++- 5 files changed, 32 insertions(+), 5 deletions(-) create mode 100644 content/en/includes/lambda/alias-info.md diff --git a/assets/scss/_variables_project.scss b/assets/scss/_variables_project.scss index de298eb5..e7364c95 100644 --- a/assets/scss/_variables_project.scss +++ b/assets/scss/_variables_project.scss @@ -1,6 +1,16 @@ /* Add styles or override variables from the theme here. https://www.docsy.dev/docs/adding-content/lookandfeel/#fonts + +Docsy's default colors +$primary: #30638e !default; +$secondary: #ffa630 !default; +$success: #3772ff !default; +$info: #c0e0de !default; +$warning: #ed6a5a !default; +$danger: #ed6a5a !default; +$light: #d3f3ee !default; // TODO: consider using BS value +$dark: #403f4c !default; // TODO: consider using BS value */ @@ -23,6 +33,7 @@ https://www.docsy.dev/docs/adding-content/lookandfeel/#fonts $primary: #001321; $dark: #001321; +$info: #ffa62f; $google_font_name: "Open Sans"; $google_font_family: "Open+Sans:300,300i,400,400i,700,700i"; @@ -34,6 +45,8 @@ $border_grey: #D7DDE3; $container_spacing: 16px; $mustard_yellow: #F3B722; + + @mixin mobile { @media (max-width: 500px) { @content; } } diff --git a/content/en/deployment/lambda/overview/index.md b/content/en/deployment/lambda/overview/index.md index 1ec56317..10aad21b 100644 --- a/content/en/deployment/lambda/overview/index.md +++ b/content/en/deployment/lambda/overview/index.md @@ -281,13 +281,16 @@ strategies: For subsequent deployments, you could use a canary strategy that splits traffic. CD-as-a-Service uses your function's AWS Lambda [alias](https://docs.aws.amazon.com/lambda/latest/dg/configuration-aliases.html) when splitting traffic between versions. ->You must create the alias in the AWS Lambda console before using the alias in your CD-as-a-Service deployment. - This example is for deployment to multiple regions in a single AWS Account. The canary strategy splits traffic. You declare your function's alias in the `trafficManagement` section. There are two entries in the `trafficManagement` section since both staging and prod targets use the traffic split strategy. +{{< include "lambda/alias-info.md" >}} + +This example assumes you have already created an alias named `v2` + {{< readfile file="/includes/code/lambda-traffic-split-snippet.yaml" code="true" lang="yaml" >}} + ## {{% heading "nextSteps" %}} * Work through the [AWS Lambda Quickstart]({{< ref "get-started/lambda" >}}) to deploy a sample function to your AWS Account. diff --git a/content/en/includes/code/lambda-traffic-split-snippet.yaml b/content/en/includes/code/lambda-traffic-split-snippet.yaml index e8b18d51..e223b4fe 100644 --- a/content/en/includes/code/lambda-traffic-split-snippet.yaml +++ b/content/en/includes/code/lambda-traffic-split-snippet.yaml @@ -42,8 +42,8 @@ trafficManagement: - targets: ['prod-us-east-1'] alias: - functionName: just-sweet-potatoes-us-east-1 - aliasName: live-version + aliasName: v2 - targets: ['prod-us-east-2'] alias: - functionName: just-sweet-potatoes-us-east-2 - aliasName: live-version + aliasName: v2 diff --git a/content/en/includes/lambda/alias-info.md b/content/en/includes/lambda/alias-info.md new file mode 100644 index 00000000..f99e8664 --- /dev/null +++ b/content/en/includes/lambda/alias-info.md @@ -0,0 +1,7 @@ +--- +--- +{{% alert title="Important" color="info" %}} +* When CDaaS creates an alias as part of a deployment, it creates the alias at the end of the deployment. +* During the deployment that creates the alias, CD-as-a-Service ignores the `setWeight` steps for that function. +* You should only route traffic to the alias after the deployment has completed. +{{% /alert %}} \ No newline at end of file diff --git a/content/en/reference/deployment/config-file/traffic-management.md b/content/en/reference/deployment/config-file/traffic-management.md index 6f47600a..a83624e6 100644 --- a/content/en/reference/deployment/config-file/traffic-management.md +++ b/content/en/reference/deployment/config-file/traffic-management.md @@ -12,6 +12,10 @@ description: > You declare your AWS Lambda alias per target in this section. CD-as-a-Service uses [aliases](https://docs.aws.amazon.com/lambda/latest/dg/configuration-aliases.html) when routing traffic from the previous version to the latest version of your function. +CD-as-a-Service creates the alias if the alias doesn't already exist in AWS Lambda. + +{{< include "lambda/alias-info.md" >}} + ```yaml trafficManagement: - targets: [""] @@ -22,7 +26,7 @@ trafficManagement: * `targets`: the list of targets using this alias * `functionName`: This is the same value as `artifacts.functionName` and `providerOptions.lambda.name`. See {{< linkWithTitle "reference/deployment/config-file/artifacts.md" >}} for details on those sections. -* `aliasName`: The alias name, such as "live-version". Your function's alias must already exist in the AWS Lambda console. +* `aliasName`: The alias name, such as "live-version". CD-as-a-Service creates the alias if it doesn't already exist in the AWS Lambda console. This example declares a traffic split canary strategy. You must declare your function's alias for each deployment target that uses the traffic split strategy.