Create policy Cloud formation

0

Why I get syntax error when I try to create a cloud formation policy using this while I get this directly from AWS documentation? what I'm missing?

{ “Type”: “AWS::IAM::UserPolicy”, “Properties”: { “PolicyName”: “CFNUsers”, “PolicyDocument”: { “Version”: “2012-10-17", “Statement”: [ { “Effect”: “Allow”, “Action”: [ “cloudformation:Describe*“, “cloudformation:List*“, “cloudformation:Get*” ], “Resource”: “*” } ] }, “Groups”: [ { “Ref”: “CFNUserGroup” } ] }

hesham
gefragt vor einem Monat91 Aufrufe
1 Antwort
0

Two things I notice, the first your quotes are not actually double-quotes - you have and not ", this would cause an issue, but this could also be just an artifact of not using a code-block when you copied-and-pasted your question. Second, you do not have a full valid template here, only a snippet.

A json version of this template that works is:

{
    "AWSTemplateFormatVersion": "2010-09-09",
    "Description": "Configure the AWSCloudFormationStackSetAdministrationRole to enable use of AWS CloudFormation StackSets.",
    "Resources": {
        "CFNUserGroup": {
            "Type": "AWS::IAM::Group",
            "Properties": {
                "GroupName": "CloudFormationUserGroup"
            }
        },
        "AdministrationRole": {
            "Type": "AWS::IAM::Policy",
            "Properties": {
                "PolicyName": "CFNUsers",
                "PolicyDocument": {
                    "Version": "2012-10-17",
                    "Statement": [
                        {
                            "Effect": "Allow",
                            "Action": [
                                "cloudformation:Describe*",
                                "cloudformation:List*",
                                "cloudformation:Get*"
                            ],
                            "Resource": "*"
                        }
                    ]
                },
                "Groups": [
                    {
                        "Ref": "CFNUserGroup"
                    }
                ]
            }
        }
    }
}

And the same template in YAML (which I personally find easier to use with CloudFormation) is:

AWSTemplateFormatVersion: '2010-09-09'
Description: Configure the AWSCloudFormationStackSetAdministrationRole to enable use of AWS CloudFormation StackSets.
Resources:
  CFNUserGroup:
    Type: AWS::IAM::Group
    Properties:
      GroupName: CloudFormationUserGroup
  AdministrationRole:
    Type: AWS::IAM::Policy
    Properties:
      PolicyName: CFNUsers
      PolicyDocument:
        Version: '2012-10-17'
        Statement:
          - Effect: Allow
            Action:
              - cloudformation:Describe*
              - cloudformation:List*
              - cloudformation:Get*
            Resource: '*'
      Groups:
        - !Ref CFNUserGroup

Try one of them - and see if you still have an issue.

AWS
EXPERTE
beantwortet vor einem Monat
profile picture
EXPERTE
überprüft vor einem Monat

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen