AWS
CloudFormation
Authorization Error
CreateStack
IAM Permissions

User is not authorized to perform cloudformationCreateStack

Master System Design with Codemia

Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.

In the realm of cloud computing, effective access control and permission management are paramount for maintaining security and operational efficiency. One common error that administrators and developers encounter when working with AWS CloudFormation is: "User is not authorized to perform: cloudformation:CreateStack". This article intends to delve into the causes and resolutions of this authorization error, utilizing technical illustrations where applicable, and providing a concise summary to aid in understanding and resolution.

Understanding AWS IAM and CloudFormation

AWS Identity and Access Management (IAM) is a powerful service provided by AWS that helps manage permissions and access across AWS resources. IAM ensures that only authorized users and applications have appropriate levels of access to specific AWS resources.

AWS CloudFormation is a service that gives developers and businesses an easy way to create a collection of related AWS and third-party resources, and provision them in an orderly and predictable fashion. CloudFormation helps automate and manage the lifecycle of AWS infrastructure using predefined templates described in JSON or YAML.

The Error: User is not authorized to perform: cloudformation:CreateStack

The error message "User is not authorized to perform: cloudformation:CreateStack" indicates that the IAM entity (user or role) attempting to execute the CreateStack operation does not have the necessary permissions to perform this action.

Key Reasons for the Error

  1. Missing Permissions: The IAM entity hasn't been granted the permission cloudformation:CreateStack.
  2. Explicit Deny: There could be an explicit Deny on the permissions policy associated with the user or role.
  3. Inaccurate Role Association: The user might not be assuming the correct IAM role intended for managing CloudFormation stacks.
  4. Service Control Policies: If AWS Organizations is being used, Service Control Policies (SCP) might restrict actions on certain AWS accounts.
  5. Permission Boundaries: These boundaries could limit the roles or users from executing the action even when it appears they have the necessary permissions.

Resolving the Error

To resolve the authorization error, one can follow these steps:

  1. Verify IAM Policy:
    • Ensure that the IAM user or role has an inline or managed policy that includes the permission cloudformation:CreateStack.
      Example of a policy JSON:
json
1      {
2          "Version": "2012-10-17",
3          "Statement": [
4              {
5                  "Effect": "Allow",
6                  "Action": "cloudformation:CreateStack",
7                  "Resource": "*"
8              }
9          ]
10      }
  1. Check for Explicit Deny:
    • Review all policies attached to the IAM user and other applicable entities to ensure there are no statements with Effect set to Deny for cloudformation:CreateStack.
  2. Role Correctness:
    • Confirm that the AWS CLI, SDK, or the AWS Management Console is using the correct role that has the required permissions.
  3. Service Control Policies:
    • Examine SCPs within AWS Organizations to verify they permit the operation. SCPs can either allow or deny permissions for entire accounts.
  4. Permissions Boundary:
    • Check if there's a permissions boundary set that might be imposing additional restrictions.

Common Scenarios

  1. Developers in a team environment: Often, developers operate under specific IAM policies that might lack permissions for CloudFormation activities. They may need admin intervention to modify or create policies.
  2. Automated Deployment Tools: When using CI/CD pipelines or other automation tools, ensure the roles they assume have necessary permissions.
  3. Cross-Account Deployment: For deployments targeting different AWS accounts, it's essential to ensure correct trust relationships and permissions between the accounts.

Summary Table

Key AspectsDetails
Primary ErrorUser is not authorized to perform: cloudformation:CreateStack
CauseLack of permission in the IAM policy, explicit deny, incorrect role, SCPs constraints, permissions boundary limitations
Resolution StepsVerify and update IAM policies, check explicit denies, correct IAM roles, revise SCPs, re-evaluate permissions boundaries
Critical Services InvolvedAWS IAM, AWS CloudFormation, AWS Organizations
Common ScenariosTeam development environment issues Automated deployments require proper IAM role setups Cross-account trust relationships

Conclusion

Managing permissions and understanding errors related to AWS services is crucial for the efficient and secure operation of cloud resources. The "User is not authorized to perform: cloudformation:CreateStack" error, though straightforward in its message, can stem from multifaceted issues within IAM configurations. By systematically diagnosing and rectifying the configuration, users can effectively overcome this authorization hurdle and streamline their infrastructure provisioning processes.


Course illustration
Course illustration

All Rights Reserved.