Go service configured with AWS components

I currently have a go service deployed on a single machine that does some work and sends logs into a dynamodb instance. I configured it via having a credentials file in the ~/.aws dir and the sdk automatically reads it.

I want to deploy this service with fly io. What changes do I need to make so that the aws part will be configured properly? My code to init the dynamodb session looks like the following

sess, err := session.NewSession(&aws.Config{
	Region: aws.String("us-east-1"),
})
if err != nil {
	log.Fatal(err)
}
svc := dynamodb.New(sess)

I see that in the doc of running a go app that flyctl launch

First, this command scans your source code to determine how to build a deployment image as well as identify any other configuration your app needs, such as secrets and exposed ports.

Just want to see how this is being done, and what is scanned during this phase.

Hello there! You just need to set up the AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY as secret environment variables.

Your code should work correctly. Additionally, here’s an example of how to initialize an AWS session in Go:

sess := session.Must(session.NewSessionWithOptions(session.Options{
    Config: aws.Config{
        Region: aws.String(region),
    },
}))

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.