[id="{beatname_lc}-installation-configuration"]
[role="xpack"]
== {beatname_uc} quick start: installation and configuration

++++
<titleabbrev>Quick start: installation and configuration</titleabbrev>
++++

This guide describes how to get started quickly monitoring data from your cloud
services. You'll learn how to:


* download the {beatname_uc} distribution
* configure details about the cloud functions you want to deploy, including the
services to monitor and triggers
* deploy the cloud functions to your serverless environment
* collect data from cloud services and ship it to the {stack}
* visualize the data in {kib}

[float]
[[install]]
=== Step 1: Download {beatname_uc}

The {beatname_uc} distribution contains the command line tools, configuration
file, and binary code required to run {beatname_uc} in your serverless
environment. 

To download and extract the package, use the commands that work with your
system.

include::{libbeat-dir}/tab-widgets/install-linux-mac-win-short-widget.asciidoc[]

[float]
[[set-connection]]
=== Step 2: Connect to the {stack}

include::{libbeat-dir}/shared/connecting-to-es.asciidoc[]

[float]
[[configuration]]
=== Step 3: Configure cloud functions

Before deploying {beatname_uc} to your cloud provider, you need to specify
details about the cloud functions that you want to deploy, including the
function name and type, and the triggers that will cause the function to
execute. 

. In +{beatname_lc}.yml+, configure the functions that you want to deploy. The
configuration settings vary depending on the type of function and cloud provider
you're using. This section provides a couple of example configurations.
+
--
* *AWS example*: This example configures a function called `cloudwatch` that
collects events from CloudWatch Logs. When a message is sent to the specified
log group, the cloud function executes and sends message events to the
configured output:
+
["source","sh",subs="attributes"]
-------------------------------------------------------------------------------------
{beatname_lc}.provider.aws.endpoint: "s3.amazonaws.com"
{beatname_lc}.provider.aws.deploy_bucket: "functionbeat-deploy" <1>
{beatname_lc}.provider.aws.functions:
  - name: cloudwatch <2>
    enabled: true
    type: cloudwatch_logs
    description: "lambda function for cloudwatch logs"
    triggers:
      - log_group_name: /aws/lambda/my-lambda-function
-------------------------------------------------------------------------------------
<1> A unique name for the S3 bucket to which the functions will be
uploaded.
<2> Details about the function you want to deploy, including the name of the
function, the type of service to monitor, and the log groups that trigger the
function.
+
See <<configuration-{beatname_lc}-options>> for more examples.

* *Google cloud example*: This example configures a function called
`storage` that collects log events from Google Cloud Storage. When the specified
event type occurs on the Cloud Storage bucket, the cloud function executes and
sends events to the configured output:
+
["source","sh",subs="attributes"]
----
functionbeat.provider.gcp.location_id: "europe-west2"
functionbeat.provider.gcp.project_id: "my-project-123456"
functionbeat.provider.gcp.storage_name: "functionbeat-deploy" <1>
functionbeat.provider.gcp.functions:
  - name: storage <2>
    enabled: true
    type: storage
    description: "Google Cloud Function for Cloud Storage"
    trigger:
      resource: "projects/my-project/buckets/my-storage"
      event_type: "google.storage.object.finalize"
----
<1> The name of the GCP storage bucket where the function artifacts will be
deployed.
<2> Details about the function you want to deploy, including the name of the
function, the type of resource to monitor, and the resource event that triggers
the function.
+
See <<configuration-{beatname_lc}-gcp-options>> for more examples.

--

include::{libbeat-dir}/shared/config-check.asciidoc[]

[float]
[[setup-assets]]
=== Step 4: Set up assets

{beatname_uc} comes with predefined assets for parsing, indexing, and
visualizing your data. To load these assets:

. Make sure the user specified in +{beatname_lc}.yml+ is
<<privileges-to-setup-beats,authorized to set up {beatname_uc}>>.

. From the installation directory, run:
+
--
include::{libbeat-dir}/tab-widgets/setup-linux-mac-win-widget.asciidoc[]
--
+
`-e` is optional and sends output to standard error instead of the configured log output.

This step loads the recommended {ref}/indices-templates.html[index template] for writing to {es}.

[TIP]
=====
A connection to {es} (or {ess}) is required to set up the initial
environment. If you're using a different output, such as {ls}, see
<<load-template-manually>>.
=====

[float]
[id="{beatname_lc}-deploying"]
[role="xpack"]
=== Step 5: Deploy {beatname_uc}

To deploy {beatname_uc} functions to your cloud provider, either use the
{beatname_uc} manager, as described here, or <<own-deployment,use your own
deployment infrastructure>>.

TIP: If you change the configuration after deploying the function, use
the <<update-command,`update` command>> to update your deployment.

[float]
[[deploy-to-aws]]
==== Deploy to AWS

. Make sure you have the credentials required to authenticate with AWS. You can
set environment variables that contain your credentials:
+
--
include::tab-widgets/credentials-aws-widget.asciidoc[]
--
+
Set `AWS_DEFAULT_REGION` to the region where your services are running.

. Make sure the user has the permissions required to deploy and run the
function. For more information, see <<iam-permissions>>.

. Deploy the cloud functions.
+
For example, the following command deploys a function called `cloudwatch`: 
+
--
include::tab-widgets/deploy-aws-widget.asciidoc[]
--
+
The function is deployed to AWS and ready to send log events to the configured
output.
+
If deployment fails, see <<faq>> for help troubleshooting.

:fnexample!:

[float]
[[deploy-to-gcp]]
==== Deploy to Google Cloud Platform

beta[]

. In Google Cloud, create a service account that has these required roles:
+
--
include::iam-permissions.asciidoc[tag=gcp-roles-deployment]
--
+
See the https://cloud.google.com/docs/authentication/getting-started[Google
Cloud documentation] for more information about creating a service account.

. Set the `GOOGLE_APPLICATION_CREDENTIALS` environment variable to point to
the JSON file that contains your service account key. For example:
+
--
include::tab-widgets/credentials-google-widget.asciidoc[]
--

. Deploy the cloud functions.
+
For example, the following command deploys a function called `storage`: 
+
--
include::tab-widgets/deploy-google-widget.asciidoc[]
--
+
The function is deployed to Google Cloud Platform and ready to send events
to the configured output.
+
If deployment fails, see <<faq>> for help troubleshooting.

[float]
[[view-data]]
=== Step 6: View your data in {kib}

There are currently no example dashboards available for {beatname_uc}.

To learn how to view and explore your data, see the
_{kibana-ref}/index.html[{kib} User Guide]_.

[float]
=== What's next?

Now that you have your cloud data streaming into {es}, learn how to unify your
logs, metrics, uptime, and application performance data.

include::{libbeat-dir}/shared/obs-apps.asciidoc[]

// Add Javascript and CSS for tabbed panels
include::{libbeat-dir}/tab-widgets/code.asciidoc[]
