본문 바로가기
공부/IaC

[AWS CloudFormation] #6 IAM User, Policy 생성

by haejang 2021. 1. 6.
728x90
728x90

 

>>진행한 실습 GitHub

 

1. IAM User 바로 만들기

AWS::IAM::User

Resources:
  AdminUser:
    Type: AWS::IAM::User
    Properties:
      LoginProfile:
        Password: P@ssw0rd
      Policies:
        - PolicyDocument:
            Version: 2012-10-17
            Statement:
              - Effect: Allow
                Action: '*'
                Resource: '*'
          PolicyName: Admin
      UserName: Admin1

AdministratorAccess의 정책을 가져와봤다

 

2. IAM Policy를 만들어서 User에 붙이기

AWS::IAM::Policy

Resources:
  AdminUser:
    Type: AWS::IAM::User
    Properties:
      LoginProfile:
        Password: P@ssw0rd
      UserName: Admin2

  AdminPolicy:
    Type: AWS::IAM::Policy
    Properties:
      PolicyDocument:
        Version: 2012-10-17
        Statement:
          - Effect: Allow
            Action: '*'
            Resource: '*'
      PolicyName: Admin
      Users:
        - !Ref AdminUser

깡통User를 하나 만든 후, Policy에 AdministratorAccess 내용 넣어준 후 User를 연결해줬다

 

 

iam-user.yaml
0.00MB
iam-user-policy.yaml
0.00MB

 

스택을 생성해보면

 

2개가 잘 만들어졌다

들어가보면 둘 다

 

 

Admin 정책이 연결되어 있다

 

728x90
728x90

댓글