Deploy Elastic Serverless Forwarder from SARedit
There are several deployment methods available via the AWS Serverless Application Repository (SAR):
To deploy the forwarder directly without using SAR, refer to Deploy Elastic Serverless Forwarder directly
Deploy using AWS Consoleedit
- Log in to AWS console and open Lambda.
- Click Applications and then Create application.
- Click Serverless application and search for elastic-serverless-forwarder.
-
Select elastic-serverless-forwarder from the search results (ignoring any application beginning helper-).
- Complete the Application settings according to Define deployment parameters
- After your settings have been added, click Deploy.
- On the Applications page for serverlessrepo-elastic-serverless-forwarder, click Deployments.
-
Refresh the Deployment history until you see the
Create complete
status update. It should take around 5 minutes to deploy — if the deployment fails for any reason, the create events will be rolled back and you will be able to see an explanation for which event failed. -
(Optional) To enable Elastic APM instrumentation for your new deployment:
- Go to Lambda > Functions within AWS console, and find and select the function with serverlessrepo-.
- Go to Configuration tab and select Environment Variables
-
Add the following environment variables:
| Key | Value | |---------------------------|--------| |`ELASTIC_APM_ACTIVE` | `true` | |`ELASTIC_APM_SECRET_TOKEN` | token | |`ELASTIC_APM_SERVER_URL` | url |
If you have already successfully deployed the forwarder but want to update the application (for example, if a new version of the Lambda function is released), you should go through this deploy step again and use the same Application name. This will ensure the function is updated rather than duplicated or created anew.
Deploy using Cloudformationedit
-
Use the following code to get the semantic version of the latest application:
aws serverlessrepo list-application-versions --application-id arn:aws:serverlessrepo:eu-central-1:267093732750:applications/elastic-serverless-forwarder
-
Save the following YAML content as
sar-application.yaml
and fill in the correct parameters according to Define deployment parameters:Transform: AWS::Serverless-2016-10-31 Resources: SarCloudformationDeployment: Type: AWS::Serverless::Application Properties: Location: ApplicationId: 'arn:aws:serverlessrepo:eu-central-1:267093732750:applications/elastic-serverless-forwarder' SemanticVersion: '%SEMANTICVERSION%' ## SET TO CORRECT SEMANTIC VERSION (MUST BE GREATER THAN 1.6.0) Parameters: ElasticServerlessForwarderS3ConfigFile: "" ElasticServerlessForwarderSSMSecrets: "" ElasticServerlessForwarderKMSKeys: "" ElasticServerlessForwarderSQSEvents: "" ElasticServerlessForwarderS3SQSEvents: "" ElasticServerlessForwarderKinesisEvents: "" ElasticServerlessForwarderCloudWatchLogsEvents: "" ElasticServerlessForwarderS3Buckets: "" ElasticServerlessForwarderSecurityGroups: "" ElasticServerlessForwarderSubnets: ""
-
Deploy the Lambda function from SAR by running the following command:
aws cloudformation deploy --template-file sar-application.yaml --stack-name esf-cloudformation-deployment --capabilities CAPABILITY_IAM CAPABILITY_AUTO_EXPAND
Starting from v1.4.0, if you want to update the Events settings for the forwarder, you do not need to manually delete existing settings before applying new settings.
Deploy using Terraformedit
-
Save the following yaml content as
sar-application.tf
and fill in the correct parameters according to Define deployment parameters:provider "aws" { region = "" ## FILL WITH THE AWS REGION WHERE YOU WANT TO DEPLOY THE ELASTIC SERVERLESS FORWARDER } data "aws_serverlessapplicationrepository_application" "esf_sar" { application_id = "arn:aws:serverlessrepo:eu-central-1:267093732750:applications/elastic-serverless-forwarder" } resource "aws_serverlessapplicationrepository_cloudformation_stack" "esf_cf_stak" { name = "terraform-elastic-serverless-forwarder" application_id = data.aws_serverlessapplicationrepository_application.esf_sar.application_id semantic_version = data.aws_serverlessapplicationrepository_application.esf_sar.semantic_version capabilities = data.aws_serverlessapplicationrepository_application.esf_sar.required_capabilities parameters = { ElasticServerlessForwarderS3ConfigFile = "" ElasticServerlessForwarderSSMSecrets = "" ElasticServerlessForwarderKMSKeys = "" ElasticServerlessForwarderSQSEvents = "" ElasticServerlessForwarderS3SQSEvents = "" ElasticServerlessForwarderKinesisEvents = "" ElasticServerlessForwarderCloudWatchLogsEvents = "" ElasticServerlessForwarderS3Buckets = "" ElasticServerlessForwarderSecurityGroups = "" ElasticServerlessForwarderSubnets = "" } }
-
Deploy the function from SAR by running the following commands:
terrafrom init terrafrom apply
From v1.4.0 and above, if you want to update the Events settings for the deployment, it is no longer required to manually delete existing settings before applying the new settings.
Due to a Terraform bug related to aws_serverlessapplicationrepository_application
, if you want to delete existing Event parameters you have to set the related aws_serverlessapplicationrepository_cloudformation_stack.parameters
to a blank space value (" "
) instead of an empty string (""
).