MCPcopy Create free account
hub / github.com/awsdocs/aws-lambda-developer-guide / init

Function init

sample-apps/example-go/function/main.go:26–34  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

24)
25
26func init() {
27 // Initialize the S3 client outside of the handler, during the init phase
28 cfg, err := config.LoadDefaultConfig(context.TODO())
29 if err != nil {
30 log.Fatalf("unable to load SDK config, %v", err)
31 }
32
33 s3Client = s3.NewFromConfig(cfg)
34}
35
36func uploadReceiptToS3(ctx context.Context, bucketName, key, receiptContent string) error {
37 _, err := s3Client.PutObject(ctx, &s3.PutObjectInput{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected