Advertisement
Guest User

Untitled

a guest
Aug 19th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. package awsutils
  2.  
  3. import (
  4. "fmt"
  5.  
  6. "github.com/aws/aws-sdk-go/aws"
  7. "github.com/aws/aws-sdk-go/aws/session"
  8. "github.com/aws/aws-sdk-go/service/ssm"
  9. )
  10.  
  11. /*
  12. GetSMM returns the value from AWS system parameter store
  13. */
  14. func GetSMM() {
  15. // This picks the env variable AWS_PROFILE, and AWS_REGION
  16. sess := session.Must(session.NewSessionWithOptions(session.Options{
  17. SharedConfigState: session.SharedConfigEnable,
  18. }))
  19.  
  20. ssmClient := ssm.New(sess)
  21. getParametersByPathInput := &ssm.GetParameterInput{
  22. Name: aws.String("/PlatformConfig/your/path/here"),
  23. WithDecryption: aws.Bool(false),
  24. }
  25. param, err := ssmClient.GetParameter(getParametersByPathInput)
  26.  
  27. if err != nil {
  28. panic(err)
  29. }
  30.  
  31. fmt.Printf("The value of the parameter: %s", *param.Parameter.Value)
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement