Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MalformedPolicyDocument when calling the CreatePolicy operation - AWS

I am trying to configure ALB Ingress Controller on Amazon EKS and following steps outlined in the document https://docs.aws.amazon.com/eks/latest/userguide/alb-ingress.html

however, when i run

aws iam create-policy \
    --policy-name ALBIngressControllerIAMPolicy \
    --policy-document https://raw.githubusercontent.com/kubernetes-sigs/aws-alb-ingress-controller/v1.1.4/docs/examples/iam-policy.json

I am getting the following error An error occurred (MalformedPolicyDocument) when calling the CreatePolicy operation: Syntax errors in policy

any help in fixing this would be great, Thanks.

like image 988
opensource-developer Avatar asked Feb 24 '20 12:02

opensource-developer


2 Answers

For anyone who might see a similar issue, I downloaded the json and point to the file using the file protocol.

aws iam create-policy \
    --policy-name ALBIngressControllerIAMPolicy \
    --policy-document file:///iam-policy.json

I found the answer here AWS malformed policy error

like image 200
opensource-developer Avatar answered Nov 10 '22 22:11

opensource-developer


Just put quotes ' on json call:

aws iam create-policy \
        --policy-name ALBIngressControllerIAMPolicy \
        --policy-document 'https://raw.githubusercontent.com/kubernetes-sigs/aws-alb-ingress-controller/v1.1.4/docs/examples/iam-policy.json'
like image 1
Vasconcelos Avatar answered Nov 10 '22 23:11

Vasconcelos