Create a policy
Arguments
- name
(character) a policy name. required
- document
(character) the policy document you want to use as the content for the new policy. required.
- path
(character) the path for the policy. if not given default is "/". optional
- description
(character) a friendly description of the policy. optional. cannot be changed after assigning it
(character) a vector of tags that you want to attach to the new IAM policy. Each tag consists of a key name and an associated value. optional
See also
Other policies:
as_policy_arn()
,
aws_policies()
,
aws_policy()
,
aws_policy_attach()
,
aws_policy_delete()
,
aws_policy_delete_version()
,
aws_policy_detach()
,
aws_policy_exists()
,
aws_policy_list_entities()
,
aws_policy_list_versions()
,
aws_policy_update()
Examples
if (FALSE) { # aws_has_creds()
if (aws_policy_exists("MyPolicy123")) {
aws_policy_delete("MyPolicy123")
}
# Create policy document
st8ment1 <- aws_policy_statement("iam:GetUser", "*")
st8ment2 <- aws_policy_statement("s3:ListAllMyBuckets", "*")
doc <- aws_policy_document_create(st8ment1, st8ment2)
# Create policy
aws_policy_create("MyPolicy123", document = doc)
# cleanup - delete policy
aws_policy_delete("MyPolicy123")
}