diff --git a/content/en/armory-enterprise/armory-admin/aws/aws-lambda.md b/content/en/armory-enterprise/armory-admin/aws/aws-lambda.md index 1042e625ce..4b020decae 100644 --- a/content/en/armory-enterprise/armory-admin/aws/aws-lambda.md +++ b/content/en/armory-enterprise/armory-admin/aws/aws-lambda.md @@ -1,17 +1,19 @@ --- -title: Configure AWS Lambda for Spinnakerâ„¢ +title: Configure AWS Lambda for Armory Enterprise linkTitle: Configure AWS Lambda description: > - Enable Spinnaker to deploy apps to AWS Lambda. + Configure Armory Enterprise or Spinnaker to deploy apps to AWS Lambda. --- ## Overview Armory supports using AWS Lambda as a deployment target for your apps and includes a variety of Lambda specific stages. Enabling the full suite of features for Lambda support requires updating the configurations for core Spinnaker services and adding the Lambda Plugin. Depending on how you manage Spinnaker, this requires Operator config updates. -## Requirements +## {{% heading "prereq" %}} -AWS Lambda support requires either Spinnaker 1.23+ or Armory 2.23+. +- AWS Lambda support requires either Spinnaker 1.23+ or Armory 2.23+. +- Make sure the `SpinnakerManaged` role has permission to work with Lambda +- Make sure your Armory Enterprise instance can access the [Spinnaker plugins repo](https://github.com/spinnaker-plugins) ## Configuration @@ -24,26 +26,26 @@ First, enable Lambda as a deployment target for your apps by updating the settin In the `spinnakerservice` manifest, update the `spinnakerConfig` section to include the properties for Lambda: ```yaml -apiVersion: spinnaker.armory.io/v1alpha2 +apiVersion: spinnaker.armory.io/{{< param "operator-extended-crd-version" >}} kind: SpinnakerService metadata: name: spinnaker spec: spinnakerConfig: profiles: - deck: # Enables Lambda Functions UI + deck: # Enables Lambda Functions UI settings-local.js: | window.spinnakerSettings.feature.functions = true - clouddriver: # Enables Lambda Functions in "Infrastructure" + clouddriver: # Enables Lambda Functions in "Infrastructure" aws: features: lambda: enabled: true accounts: - - name: aws-dev # NOTE: This merge is Index based - so if you do not want to overwrite spinnakerConfig.config.providers.aws.accounts you must create another account in the list + - name: # NOTE: This merge is Index based - so if you do not want to overwrite spinnakerConfig.config.providers.aws.accounts you must create another account in the list lambdaEnabled: true - accountId: "xxxxxxxx" # (Required) - assumeRole: role/spinnaker # (Required) + accountId: "xxxxxxxx" # (Required) + assumeRole: role/spinnakerManaged # (Required) ``` ### Adding AWS Lambda Plugin @@ -56,7 +58,7 @@ Next, add the Lambda Plugin to include the Lambda stages (Delete, Deploy, Invoke # # Documentation: https://github.com/spinnaker-plugins/aws-lambda-deployment-plugin-spinnaker #----------------------------------------------------------------------------------------------------------------- -apiVersion: spinnaker.armory.io/v1alpha2 +apiVersion: spinnaker.armory.io/{{< param "operator-extended-crd-version" >}} kind: SpinnakerService metadata: name: spinnaker @@ -81,10 +83,12 @@ spec: plugins: Aws.LambdaDeploymentPlugin: enabled: true - version: 1.0.1 - # extensions: - # Aws.LambdaDeploymentStage: - # enabled: true + version: + extensions: + Aws.LambdaDeploymentStage: + enabled: true + config: + defaultMaxWaitTime: 20 # default is 20 repositories: awsLambdaDeploymentPluginRepo: id: awsLambdaDeploymentPluginRepo @@ -113,3 +117,10 @@ See the following links for more information: * [GitHub - AWS-Lambda-Deployment-Plugin-Spinnaker](https://github.com/spinnaker-plugins/aws-lambda-deployment-plugin-spinnaker) * [AWS Blog - How to integrate AWS Lambda with Spinnaker](https://aws.amazon.com/blogs/opensource/how-to-integrate-aws-lambda-with-spinnaker/) + +## {{% heading "nextSteps" %}} + +{{< linkWithTitle "aws-using-lambda.md" >}} + +
+
diff --git a/content/en/armory-enterprise/spinnaker-user-guides/aws-guides/aws-using-lambda.md b/content/en/armory-enterprise/spinnaker-user-guides/aws-guides/aws-using-lambda.md new file mode 100644 index 0000000000..612bc55d7a --- /dev/null +++ b/content/en/armory-enterprise/spinnaker-user-guides/aws-guides/aws-using-lambda.md @@ -0,0 +1,105 @@ +--- +title: Use AWS Lambda in Armory Enterprise +linkTitle: Use AWS Lambda +description: > + Learn how to use AWS Lambda in a Spinnaker pipeline. +--- + +## {{% heading "prereq" %}} + +This guide explores a pipeline that tests the various Lambda stages. To deploy the pipeline in your own Armory Enterprise instance, make sure you complete the following: + +- [Configure Armory Enterprise for AWS Lambda]({{< ref "aws-lambda">}}) +- [Create a Lambda execution role](https://docs.aws.amazon.com/lambda/latest/dg/lambda-intro-execution-role.html) +- [Create a Lambda deployment package](https://docs.aws.amazon.com/lambda/latest/dg/gettingstarted-package.html) +- Create a Lambda sample payload JSON file +- Upload the Lambda deployment package and the Lambda sample payload JSON to an S3 bucket that Armory Enterprise can access +- Make sure the `SpinnakerManaged` role has permission to work with Lambda + + +## AWS Lambda pipeline example + +This pipeline is based on the one defined in [Enhancing Spinnaker deployment experience of AWS Lambda functions with the Lambda plugin](https://aws.amazon.com/blogs/opensource/enhancing-spinnaker-deployment-experience-of-aws-lambda-functions-with-the-lambda-plugin/). + +{{< figure src="/images/user-guides/aws/lambda/lamba-pipeline-definition.jpg" caption="Example Lambda Pipeline Definition" alt="Example Lambda Pipeline Definition" >}} + + + +### Deployment stage + +This stage creates a new Lambda function, or updates a Lambda function, and sets various Lambda configurations. If you want a simple update to the code of an existing Lambda function, you should use the Update Code stage instead. + +{{< figure src="/images/user-guides/aws/lambda/lambda-deployment.jpg" caption="Example of Lambda Deployment Stage" alt="Example of Lambda Deployment Stage" >}} + + +### Update Code stage + +This stage updates the code of an existing Lambda function. + +{{< figure src="/images/user-guides/aws/lambda/lambda-update-code.jpg" caption="Example of Lambda Update Code Stage" alt="Example of Lambda Update Code Stage" >}} + +### Invoke stage + +This stage executes a Lambda function. The results of this stage are stored in the stage output, which you can access via SpEL with something like the following: + +``` +#stage('AWS Lambda Update Invoke').outputs.invokeResultsList +``` + +{{< figure src="/images/user-guides/aws/lambda/lambda-invoke.jpg" caption="Example of Lambda Revoke Stage" alt="Example of Lambda Revoke Stage" >}} + +### Route stage + +This stage routes traffic across various versions of the Lambda function. + +#### Simple strategy + +Routes 100% of the traffic to the chosen **Target Version** of the Lambda function. This example config routes 100% of the traffic to the new Lambda version. + +{{< figure src="/images/user-guides/aws/lambda/lambda-route-simple.jpg" caption="Example of Lambda Route Stage - Simple Strategy" alt="Example of Lambda Route Stage - Simple Strategy" >}} + +#### Weighted Deployment strategy + +Routes some percentage of the traffic to he chosen **Target Version** of the Lambda function. This example config routes 40% of the traffic to the new Lambda version. + +{{< figure src="/images/user-guides/aws/lambda/lambda-route-weighted.jpg" caption="Example of Lambda Route Stage - Weighted Deployment Strategy" alt="Example of Lambda Route Stage - Weighted Deployment Strategy" >}} + +#### Blue/Green strategy + +Deploys a new version and includes health check configuration to test whether the newly deployed Lambda function is working as expected before routing 100% of traffic to the new version. In case of a health check mismatch, this stage deletes the new version based on the value of the **On Fail** field. + +{{< figure src="/images/user-guides/aws/lambda/lambda-route-blue-green.jpg" caption="Example of Lambda Route Stage - Blue/Green Strategy" alt="Example of Lambda Route Stage - Blue/Green Strategy" >}} + +### Delete stage + +This stage deletes versions of your Lambda function. + +#### Newest Function Version + +Deletes the most recently deployed function version when this stage starts. + +{{< figure src="/images/user-guides/aws/lambda/lambda-delete-newest-function-version.jpg" caption="Example of Lambda Delete Stage - Newest Function Version" alt="Example of Lambda Delete Stage - Newest Function Version" >}} + +#### Previous Function Version + +Deletes the second-most recently deployed function version when this stage starts. + +{{< figure src="/images/user-guides/aws/lambda/lambda-delete-prev-function-version.jpg" caption="Example of Lambda Delete Stage - Previous Function Version" alt="Example of Lambda Delete Stage Previous Function Version configuration" >}} + +#### Older Than N + +Deletes all versions except for the number of most recent versions configured in the **Prior Versions to Retain** field. + +{{< figure src="/images/user-guides/aws/lambda/lambda-delete-older-than-n.jpg" caption="Example of Lambda Delete Stage - Older Than N" alt="Example of Lambda Delete Stage Older Than N configuration" >}} + +#### Provide Version Number + +Deletes the specific version specified in the **Version Number** field. + +{{< figure src="/images/user-guides/aws/lambda/lambda-delete-version-number.jpg" caption="Example of Lambda Delete Stage - Provide Version Number" alt="Example of Lambda Delete Stage Provide Version Number configuration" >}} + +#### All Function Versions + +Completely deletes all versions of the Lambda function and its infrastructure. + +{{< figure src="/images/user-guides/aws/lambda/lambda-delete-all-function-versions.jpg" caption="Example of Lambda Delete Stage - All Function Versions" alt="Example of Lambda Delete Stage All Function Versions configuration" >}} diff --git a/static/images/user-guides/aws/lambda/lamba-pipeline-definition.jpg b/static/images/user-guides/aws/lambda/lamba-pipeline-definition.jpg new file mode 100644 index 0000000000..8858c2f3fd Binary files /dev/null and b/static/images/user-guides/aws/lambda/lamba-pipeline-definition.jpg differ diff --git a/static/images/user-guides/aws/lambda/lambda-delete-all-function-versions.jpg b/static/images/user-guides/aws/lambda/lambda-delete-all-function-versions.jpg new file mode 100644 index 0000000000..d42d76fe4e Binary files /dev/null and b/static/images/user-guides/aws/lambda/lambda-delete-all-function-versions.jpg differ diff --git a/static/images/user-guides/aws/lambda/lambda-delete-newest-function-version.jpg b/static/images/user-guides/aws/lambda/lambda-delete-newest-function-version.jpg new file mode 100644 index 0000000000..7b512a06be Binary files /dev/null and b/static/images/user-guides/aws/lambda/lambda-delete-newest-function-version.jpg differ diff --git a/static/images/user-guides/aws/lambda/lambda-delete-older-than-n.jpg b/static/images/user-guides/aws/lambda/lambda-delete-older-than-n.jpg new file mode 100644 index 0000000000..bafbc71070 Binary files /dev/null and b/static/images/user-guides/aws/lambda/lambda-delete-older-than-n.jpg differ diff --git a/static/images/user-guides/aws/lambda/lambda-delete-prev-function-version.jpg b/static/images/user-guides/aws/lambda/lambda-delete-prev-function-version.jpg new file mode 100644 index 0000000000..4f5f289026 Binary files /dev/null and b/static/images/user-guides/aws/lambda/lambda-delete-prev-function-version.jpg differ diff --git a/static/images/user-guides/aws/lambda/lambda-delete-version-number.jpg b/static/images/user-guides/aws/lambda/lambda-delete-version-number.jpg new file mode 100644 index 0000000000..56f89d29ee Binary files /dev/null and b/static/images/user-guides/aws/lambda/lambda-delete-version-number.jpg differ diff --git a/static/images/user-guides/aws/lambda/lambda-deployment.jpg b/static/images/user-guides/aws/lambda/lambda-deployment.jpg new file mode 100644 index 0000000000..3edf9608fb Binary files /dev/null and b/static/images/user-guides/aws/lambda/lambda-deployment.jpg differ diff --git a/static/images/user-guides/aws/lambda/lambda-invoke.jpg b/static/images/user-guides/aws/lambda/lambda-invoke.jpg new file mode 100644 index 0000000000..eafd7d1ad2 Binary files /dev/null and b/static/images/user-guides/aws/lambda/lambda-invoke.jpg differ diff --git a/static/images/user-guides/aws/lambda/lambda-route-blue-green.jpg b/static/images/user-guides/aws/lambda/lambda-route-blue-green.jpg new file mode 100644 index 0000000000..5ba112c643 Binary files /dev/null and b/static/images/user-guides/aws/lambda/lambda-route-blue-green.jpg differ diff --git a/static/images/user-guides/aws/lambda/lambda-route-simple.jpg b/static/images/user-guides/aws/lambda/lambda-route-simple.jpg new file mode 100644 index 0000000000..edf1d69bb2 Binary files /dev/null and b/static/images/user-guides/aws/lambda/lambda-route-simple.jpg differ diff --git a/static/images/user-guides/aws/lambda/lambda-route-weighted.jpg b/static/images/user-guides/aws/lambda/lambda-route-weighted.jpg new file mode 100644 index 0000000000..d0cf1e74a1 Binary files /dev/null and b/static/images/user-guides/aws/lambda/lambda-route-weighted.jpg differ diff --git a/static/images/user-guides/aws/lambda/lambda-update-code.jpg b/static/images/user-guides/aws/lambda/lambda-update-code.jpg new file mode 100644 index 0000000000..fb9364a5c0 Binary files /dev/null and b/static/images/user-guides/aws/lambda/lambda-update-code.jpg differ