Skip to content

aws.accessanalyzer.get_generated_policy

Example SQL Queries

SELECT * FROM
aws.accessanalyzer.get_generated_policy
WHERE
"job_id" = 'VALUE';

Description

Retrieves the policy that was generated using StartPolicyGeneration.

Table Definition

Column NameColumn Data Type
job_id Required Input Column

The JobId that is returned by the StartPolicyGeneration operation. The JobId can be used with GetGeneratedPolicy to retrieve the generated policies or used with CancelPolicyGeneration to cancel the policy generation request.

VARCHAR
include_resource_placeholders Input Column

The level of detail that you want to generate. You can specify whether to generate policies with placeholders for resource ARNs for actions that support resource level granularity in policies.

For example, in the resource section of a policy, you can receive a placeholder such as "Resource":"arn:aws:s3:::${BucketName}" instead of "*".

BOOLEAN
include_service_level_template Input Column

The level of detail that you want to generate. You can specify whether to generate service-level policies.

IAM Access Analyzer uses iam:servicelastaccessed to identify services that have been used recently to create this service-level template.

BOOLEAN
_aws_profile Input Column

The AWS profile defines the AWS identity used. It can be defined via credentials or by assuming a IAM role.

STRUCT(
"type" VARCHAR,
"name" VARCHAR,
"account_id" VARCHAR,
"via_profile_name" VARCHAR,
"assumed_role_arn" VARCHAR,
"organization" STRUCT(
"account_name" VARCHAR,
"id" VARCHAR,
"tags" STRUCT(
"key" VARCHAR,
"value" VARCHAR
)[],
"master_account" STRUCT(
"id" VARCHAR,
"email" VARCHAR
),
"parents" STRUCT(
"type" VARCHAR,
"id" VARCHAR,
"name" VARCHAR,
"tags" STRUCT(
"key" VARCHAR,
"value" VARCHAR
)[]
)[]
)
)
Show child fields
_aws_profile.account_id

The AWS account id

_aws_profile.assumed_role_arn

The ARN of the assumed role

_aws_profile.name

The unique name of the profile.

_aws_profile.organization

Information about this profile's membership in the AWS organization.

Show child fields
_aws_profile.organization.account_name

The name of account speciifed by the organization

_aws_profile.organization.id

The organization id

_aws_profile.organization.master_account
Show child fields
_aws_profile.organization.master_account.email

The organization master account email address

_aws_profile.organization.master_account.id

The organization master account id

_aws_profile.organization.parents[]
Show child fields
_aws_profile.organization.parents[].id

The id of the parent

_aws_profile.organization.parents[].name

The name of the parent

_aws_profile.organization.parents[].tags[]
Show child fields
_aws_profile.organization.parents[].tags[].key
_aws_profile.organization.parents[].tags[].value
_aws_profile.organization.parents[].type

The type of parent can be an organization unit or a root

_aws_profile.organization.tags[]
Show child fields
_aws_profile.organization.tags[].key
_aws_profile.organization.tags[].value
_aws_profile.type

The type of profile, either 'credentials' or 'assumed_role'

_aws_profile.via_profile_name

This IAM role for this profile is assumed by first utilizing another profile with this name to obtain credentials.

generated_policy_result

A GeneratedPolicyResult object that contains the generated policies and associated details.

STRUCT(
"properties" STRUCT(
"is_complete" BOOLEAN,
"principal_arn" VARCHAR,
"cloud_trail_properties" STRUCT(
"trail_properties" STRUCT(
"cloud_trail_arn" VARCHAR,
"regions" VARCHAR[],
"all_regions" BOOLEAN
)[],
"start_time" TIMESTAMP_S,
"end_time" TIMESTAMP_S
)
),
"generated_policies" STRUCT(
"policy" VARCHAR
)[]
)
Show child fields
generated_policy_result.generated_policies[]
Show child fields
generated_policy_result.generated_policies[].policy

The text to use as the content for the new policy. The policy is created using the CreatePolicy action.

generated_policy_result.properties

A GeneratedPolicyProperties object that contains properties of the generated policy.

Show child fields
generated_policy_result.properties.cloud_trail_properties

Lists details about the Trail used to generated policy.

Show child fields
generated_policy_result.properties.cloud_trail_properties.end_time

The end of the time range for which IAM Access Analyzer reviews your CloudTrail events. Events with a timestamp after this time are not considered to generate a policy. If this is not included in the request, the default value is the current time.

generated_policy_result.properties.cloud_trail_properties.start_time

The start of the time range for which IAM Access Analyzer reviews your CloudTrail events. Events with a timestamp before this time are not considered to generate a policy.

generated_policy_result.properties.cloud_trail_properties.trail_properties[]
Show child fields
generated_policy_result.properties.cloud_trail_properties.trail_properties[].all_regions

Possible values are true or false. If set to true, IAM Access Analyzer retrieves CloudTrail data from all regions to analyze and generate a policy.

generated_policy_result.properties.cloud_trail_properties.trail_properties[].cloud_trail_arn

Specifies the ARN of the trail. The format of a trail ARN is arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail.

generated_policy_result.properties.cloud_trail_properties.trail_properties[].regions[]
generated_policy_result.properties.is_complete

This value is set to true if the generated policy contains all possible actions for a service that IAM Access Analyzer identified from the CloudTrail trail that you specified, and false otherwise.

generated_policy_result.properties.principal_arn

The ARN of the IAM entity (user or role) for which you are generating a policy.

job_details

A GeneratedPolicyDetails object that contains details about the generated policy.

STRUCT(
"job_id" VARCHAR,
"status" VARCHAR,
"started_on" TIMESTAMP_S,
"completed_on" TIMESTAMP_S,
"job_error" STRUCT(
"code" VARCHAR,
"message" VARCHAR
)
)
Show child fields
job_details.completed_on

A timestamp of when the job was completed.

job_details.job_error

The job error for the policy generation request.

Show child fields
job_details.job_error.code

The job error code.

job_details.job_error.message

Specific information about the error. For example, which service quota was exceeded or which resource was not found.

job_details.job_id

The JobId that is returned by the StartPolicyGeneration operation. The JobId can be used with GetGeneratedPolicy to retrieve the generated policies or used with CancelPolicyGeneration to cancel the policy generation request.

job_details.started_on

A timestamp of when the job was started.

job_details.status

The status of the job request.