Provide AWS account and Lambda details

Provide the details of your AWS account, the Lambda functions to access, and IAM roles to Gloo Gateway for function invocation and discovery.

Before you begin: Follow the steps in Configure AWS IAM permissions to create IAM roles for Gloo Gateway service accounts to access, discover, and invoke Lambda functions.

Define AWS settings in CloudProvider

Define your AWS region, account, and IAM roles in a CloudProvider Gloo CR. The CloudProvider CR serves as a centralized location for configuration settings for each cloud provider and the resources you want to use, such as AWS and AWS Lambda functions.

In multicluster setups, you must create CloudProvider resources in the gloo-mesh namespace of the management cluster.

apiVersion: infrastructure.gloo.solo.io/v2
kind: CloudProvider
metadata:
  name: 
  # In multicluster setups, you must create the CloudProvider in the gloo-mesh namespace of the management cluster
  namespace: 
spec:
  # AWS cloud provider settings
  aws:
    # ID for AWS account that functions are in
    accountId: 
    # AWS region that functions are in
    region: 
    # AWS Security Token Service (AWS STS) endpoint from which to retrieve AWS credentials
    # For more info, see https://docs.aws.amazon.com/eks/latest/userguide/configure-sts-endpoint.html
    stsEndpoint: 
    # Options for function invocation
    lambda:
      # Optional: Name of the IAM role that the Gateway assumes for invocation
      invokeRoleName: 
      # Options for automatic function discovery
      discovery: 
        # Automatically discover Lambda functions (true|false)
        enabled: 
        # Optional: Name of the IAM role that the management server assumes for discovery.
        # If not specified, defaults to the IRSA specified on the management server deployment.
        roleName: 
        # Optional: Filter the discovered functions
        filter: 
          # Include only functions that match this regex name filter
          name: 
          # Discover only the latest version of each function (true|false)
          latestOnly: 

Invocation (lambda.invokeRoleName)

Choose how workloads in the same workspace as the CloudProvider can invoke the Lambda functions in an AWS account. For more information about each of these options, see Decide how workloads can invoke functions.

If functions in the same account and region must use different invocation roles, you can create one CloudProvider for each role.

Discovery (lambda.discovery)

You can either configure Gloo Gateway to automatically discover functions, or list the functions yourself in a separate CloudResources resource.

Automatic discovery:

Manual list: If you prefer to select only a few functions in your AWS account and region, set lambda.discovery.enabled to false, and specify the functions in a CloudResources CR.

Define Lambda functions in CloudResources

The CloudResources CR allows you to manually specify the functions that Gloo Gateway can access and their details. Each item in the lambda list contains the name of the function in AWS (lambdaFunctionName) and the version of the function to call (qualifier).

In multicluster setups, you must create CloudResources in the gloo-mesh namespace of the management cluster.

apiVersion: infrastructure.gloo.solo.io/v2
kind: CloudResources
metadata:
  name: 
  # In multicluster setups, you must create CloudResources in the gloo-mesh namespace of the management cluster
  namespace: 
spec:
  # Name of the CloudProvider resource
  provider: 
  aws:
    # List of Lambda functions
    lambda:
        # Actual name of the function in AWS
      - lambdaFunctionName: 
        # Version of the function to call. Defaults to $LATEST. For more info, see https://docs.aws.amazon.com/lambda/latest/dg/API_Invoke.html#API_Invoke_RequestSyntax
        qualifier: 

When discovery is enabled, Gloo automatically creates a CloudResources resource that contains entries to represent each function that it discovers. If you want to make changes to the way a particular Lambda function is represented in Gloo, do not edit the auto-generated CloudResources configuration that the function is represented in, because your changes are overwritten by Gloo. Instead, you can define function details by manually creating a new CloudResources configuration, which overrides the auto-generated configuration.

Examples

Automatically discover functions

In this example:

apiVersion: infrastructure.gloo.solo.io/v2
kind: CloudProvider
metadata:
  name: aws-provider
  namespace: gloo-mesh
spec:
  aws:
    accountId: "111122223333"
    region: us-west-2
    stsEndpoint: sts.amazonaws.com
    lambda:
      invokeRoleName: invoke-team-B
      discovery:
        enabled: true
        roleName: discovery-team-B
        filter:
          name: team-B-*

Manually list functions

In this example:

apiVersion: infrastructure.gloo.solo.io/v2
kind: CloudProvider
metadata:
  name: aws-provider
  namespace: gloo-mesh
spec:
  aws:
    accountId: "111122223333"
    region: us-west-2
    stsEndpoint: sts.amazonaws.com
    lambda:
      invokeRoleName: invoke-team-A
---
apiVersion: infrastructure.gloo.solo.io/v2
kind: CloudResources
metadata:
  name: aws-functions
  namespace: gloo-mesh
spec:
  provider: aws-provider
  aws:
    lambda:
      - lambdaFunctionName: backend-function
        qualifier: $LATEST

Next steps