Skip to content

Commit fb8f88d

Browse files
mukhtarTheo
authored and
Theo
committed
Update the description in README_AutoScaling.md
Also updated the example code so it's complete and consistent with other examples + removed unused import.
1 parent 81bf74e commit fb8f88d

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

events/README_AutoScaling.md

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,21 @@
11
# Sample Function
22

3-
The following is a sample class and Lambda function that receives Amazon S3 event record data as an input and writes some of the record data to CloudWatch Logs. (Note that by default anything written to Console will be logged as CloudWatch Logs events.)
3+
The following is a sample Lambda function that receives an Auto Scaling event as an input and logs the EC2 instance ID to CloudWatch Logs. (Note that by default anything written to Console will be logged as CloudWatch Logs events.)
44

55
```go
6-
76
import (
8-
"strings"
9-
"github.com/aws/aws-lambda-go/events")
7+
"context"
8+
"fmt"
9+
10+
"github.com/aws/aws-lambda-go/events"
11+
"github.com/aws/aws-lambda-go/lambda"
12+
)
1013

1114
func handler(ctx context.Context, autoScalingEvent events.AutoScalingEvent) {
12-
fmt.Printf("Instance-Id available in event is %s \n",autoScalingEvent.Detail["EC2InstanceId"])
13-
}
15+
fmt.Printf("Instance-Id available in event is %s \n", autoScalingEvent.Detail["EC2InstanceId"])
1416
}
1517

18+
func main() {
19+
lambda.Start(handler)
20+
}
1621
```

0 commit comments

Comments
 (0)