UpdatePolicy
In this article:
UpdatePolicy#
Description#
Updates an IAM policy.
Request Parameters#
Required parameters#
PolicyName — The name of the policy.
Type: String
Required: Yes
Optional parameters#
Description — The description of the policy.
Type: String
Required: No
Document — Policy-defined access rules in JSON format.
Type: String
Required: No
Response Elements#
Policy — Updated policy details.
Type: Policy object
Examples#
Request
https://iam.k2.cloud/?Action=UpdatePolicy
&Description=new description
&Document={"Statement": [{"Action": ["iam:ListUsers"]}]}
&PolicyName=policy-1
Response
<UpdatePolicyResponse>
<UpdatePolicyResult>
<Policy>
<PolicyArn>arn:c2:iam::c2dev:policy/policy-1</PolicyArn>
<PolicyId>2cec7683-7ecf-470f-b3f1-498a140752da</PolicyId>
<PolicyName>policy-1</PolicyName>
<Owner>self</Owner>
<Type>global</Type>
<CreateDate>1724418895</CreateDate>
<UpdateDate>1724419323</UpdateDate>
<Description>new description</Description>
</Policy>
</UpdatePolicyResult>
<requestId>281f9a87-567b-4196-ac30-2dc82047eaac</requestId>
<ResponseMetadata>
<RequestId>281f9a87-567b-4196-ac30-2dc82047eaac</RequestId>
</ResponseMetadata>
</UpdatePolicyResponse>
c2-iam UpdatePolicy PolicyName policy-2 Document '{"Statement": [{"Action": ["ec2:DescribeVolumes"]}]}'
c2-iam UpdatePolicy PolicyName policy-2 Description new_description