| 1 |
# aws/aws-lambda-go instrumentation example |
| 2 |
|
| 3 |
A simple example to demonstrate the AWS Lambda for Go instrumentation. In this example, container `aws-lambda-client` initializes an S3 client and an HTTP client and runs 2 basic operations: `listS3Buckets` and `GET`. |
| 4 |
|
| 5 |
These instructions assume you have |
| 6 |
[docker-compose](https://docs.docker.com/compose/) installed and setup, and [AWS credential](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html) configured. |
| 7 |
|
| 8 |
1. From within the `example` directory, bring up the project by running: |
| 9 |
|
| 10 |
```sh |
| 11 |
docker-compose up --detach |
| 12 |
``` |
| 13 |
|
| 14 |
2. The instrumentation works with a `stdout` exporter. The example pulls this output from AWS and outputs back to stdout. |
| 15 |
To inspect the output (following build output), you can run: |
| 16 |
|
| 17 |
```sh |
| 18 |
docker-compose logs |
| 19 |
``` |
| 20 |
|
| 21 |
3. After inspecting the client logs, the example can be cleaned up by running: |
| 22 |
|
| 23 |
```sh |
| 24 |
docker-compose down |
| 25 |
``` |
| 26 |
|
| 27 |
Note: Because the example runs on AWS Lambda, a handful of resources are created in AWS by the |
| 28 |
example. The example will automatically destroy any resources it makes; however, if you |
| 29 |
terminate the container before it completes you may have leftover resources in AWS. Should |
| 30 |
you terminate the container early, run the below command to ensure all AWS resources are cleaned up: |
| 31 |
|
| 32 |
```sh |
| 33 |
./manualAWSCleanup.sh |
| 34 |
``` |