Skip to content

Instantly share code, notes, and snippets.

@rendicott rendicott/main.go
Created Jan 15, 2020

Embed
What would you like to do?
barebones golang client application for AWS
package main
import (
"fmt"
"flag"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/organizations"
)
func main() {
var profile string
var region string
flag.StringVar(&profile, "p", "default", "profile for creds")
flag.StringVar(&region, "r", "us-east-1", "region for creds")
flag.Parse()
sessProfile := session.Must(session.NewSessionWithOptions(session.Options{
Config: aws.Config{Region: &region},
Profile: profile,
}))
client := organizations.New(sessProfile)
input := organizations.ListPoliciesInput{
Filter: aws.String("SERVICE_CONTROL_POLICY"),
}
result, err := client.ListPolicies(&input)
if err != nil { panic(err)}
fmt.Println(result)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.