Step 4: Deploy Functionbeat code to your serverless environmentedit

Before deploying functions to your serverless environment, make sure your user has the credentials required to authenticate with your cloud service provider. For example, if you are deploying an AWS Lambda function, you can set environment variables that contain your credentials:

linux and mac:

export AWS_ACCESS_KEY_ID=ABCDEFGHIJKLMNOPUSER
export AWS_SECRET_ACCESS_KEY=EXAMPLE567890devgHIJKMLOPNQRSTUVZ1234KEY
export AWS_DEFAULT_REGION=us-east-1

win:

set AWS_ACCESS_KEY_ID=ABCDEFGHIJKLMNOPUSER
set AWS_SECRET_ACCESS_KEY=EXAMPLE567890devgHIJKMLOPNQRSTUVZ1234KEY
set AWS_DEFAULT_REGION=us-east-1

Set AWS_DEFAULT_REGION to the region where your services are running.

Also make sure the user has the permissions required to deploy and run the function. For more information, see IAM permissions required for deployment.

After setting credentials and verifying permissions, run the deploy command to deploy the function.

Instead of deploying from the command line, you can export an AWS CloudFormation template and use the template with automation software to deploy Functionbeat code to your cloud environment. For more information, see Export AWS CloudFormation template.

The following command deploys a function called cloudwatch:

linux and mac:

./functionbeat -v -e -d "*" deploy cloudwatch

win:

.\functionbeat.exe -v -e -d "*" deploy cloudwatch

Functionbeat is now deployed in your serverless environment and ready to send log events to the configured output.

If deployment fails, see Common problems for help troubleshooting.

If you change the configuration after deploying the function, use the update command to update your deployment.