1

I have service which using go sdk v2 to read data from parameter store. I have farget profile with pod execution role attached to it with required permissions.

func getClient() aws.Config {
cfg, err := awsconfig.LoadDefaultConfig(context.TODO())
if err != nil {
panic("configuration error, " + err.Error())
}

    return cfg

}

func ParameterStoreByName(parameterName string) (*ssm.GetParameterOutput, error) {
    input := &ssm.GetParameterInput{
        Name: &parameterName,
    }
    client := ssm.NewFromConfig(getClient())

    data, err := client.GetParameter(context.TODO(), input)
    if err != nil {
        fmt.Println(err.Error())
        return nil, err
    }
    return data, err
}

when I run this on worker (node group) node its working as expected and returns data, But when I run the same on farget profile I am getting following error

operation error SSM: GetParameter, failed to sign request: failed to retrieve credentials: failed to refresh cached credentials, no EC2 IMDS role found, operation error ec2imds: GetMetadata, request canceled, context deadline exceeded

EKS Version: 1.24

How can I make service to use aws components?

Ajay Kumar
  • 19
  • 1
  • From your error message; first check if that role really exists, then check if the execution role is attached to your Fargate profile, and has the necessary permissions to access parameter store. – Jishan Shaikh May 22 '23 at 06:51
  • Yes, I just cross validated, Role does exists with all required permissions. Also same role is attached to farget profile. – Ajay Kumar May 22 '23 at 06:55
  • The error indicates that the role is not properly configured, please check it again step-by-step from official [documentation](https://docs.aws.amazon.com/eks/latest/userguide/pod-execution-role.html) – Jishan Shaikh May 22 '23 at 08:32

0 Answers0