Setting up for AWS Glue Studio - AWS Glue Studio

Setting up for AWS Glue Studio

Complete the tasks in this section when you're using AWS Glue Studio for the first time:

Complete initial AWS configuration tasks

To use AWS Glue Studio you must first complete the following tasks:

Sign up for AWS

If you do not have an AWS account, complete the following steps to create one.

To sign up for an AWS account

  1. Open https://portal.aws.amazon.com/billing/signup.

  2. Follow the online instructions.

    Part of the sign-up procedure involves receiving a phone call and entering a verification code on the phone keypad.

    When you sign up for an AWS account, an AWS account root user is created. The root user has access to all AWS services and resources in the account. As a security best practice, assign administrative access to an administrative user, and use only the root user to perform tasks that require root user access.

Create an IAM administrator user

If your account already includes an IAM user with full AWS administrative permissions, you can skip this section.

To create an administrator user, choose one of the following options.

Choose one way to manage your administrator To By You can also
In IAM Identity Center

(Recommended)

Use short-term credentials to access AWS.

This aligns with the security best practices. For information about best practices, see Security best practices in IAM in the IAM User Guide.

Following the instructions in Getting started in the AWS IAM Identity Center (successor to AWS Single Sign-On) User Guide. Configure programmatic access by Configuring the AWS CLI to use AWS IAM Identity Center (successor to AWS Single Sign-On) in the AWS Command Line Interface User Guide.
In IAM

(Not recommended)

Use long-term credentials to access AWS. Following the instructions in Creating your first IAM admin user and user group in the IAM User Guide. Configure programmatic access by Managing access keys for IAM users in the IAM User Guide.

Sign in as an IAM user

Sign in to the IAM console by choosing IAM user and entering your AWS account ID or account alias. On the next page, enter your IAM user name and your password.

Note

For your convenience, the AWS sign-in page uses a browser cookie to remember your IAM user name and account information. If you previously signed in as a different user, choose the sign-in link beneath the button to return to the main sign-in page. From there, you can enter your AWS account ID or account alias to be redirected to the IAM user sign-in page for your account.

Review IAM permissions needed for the AWS Glue Studio user

To use AWS Glue Studio, the user must have access to various AWS resources. The user must be able to view and select Amazon S3 buckets, IAM policies and roles, and AWS Glue Data Catalog objects.

AWS Glue service permissions

AWS Glue Studio uses the actions and resources of the AWS Glue service. Your user needs permissions on these actions and resources to effectively use AWS Glue Studio. You can grant the AWS Glue Studio user the AWSGlueConsoleFullAccess managed policy, or create a custom policy with a smaller set of permissions.

Important

Per security best practices, it is recommended to restrict access by tightening policies to further restrict access to Amazon S3 bucket and Amazon CloudWatch log groups. For an example Amazon S3 policy, see Writing IAM Policies: How to Grant Access to an Amazon S3 Bucket.

Creating Custom IAM Policies for AWS Glue Studio

You can create a custom policy with a smaller set of permissions for AWS Glue Studio. The policy can grant permissions for a subset of objects or actions. Use the following information when creating a custom policy.

To use the AWS Glue Studio APIs, include glue:UseGlueStudio in the action policy in your IAM permissions. Using glue:UseGlueStudio will allow you to access all AWS Glue Studio actions even as more actions are added to the API over time.

Job Actions

  • GetJob

  • CreateJob

  • DeleteJob

  • GetJobs

  • UpdateJob

Job run Actions

  • StartJobRun

  • GetJobRuns

  • BatchStopJobRun

  • GetJobRun

Database Actions

  • GetDatabases

Plan Actions

  • GetPlan

Table Actions

  • SearchTables

  • GetTables

  • GetTable

Connection Actions

  • CreateConnection

  • DeleteConnection

  • UpdateConnection

  • GetConnections

  • GetConnection

Mapping Actions

  • GetMapping

Security Configuration Actions

  • GetSecurityConfigurations

Script Actions

  • CreateScript (different from API of same name in AWS Glue)

Accessing AWS Glue Studio APIs

To access AWS Glue Studio, add glue:UseGlueStudio in the actions policy list in the IAM permissions.

In the example below, glue:UseGlueStudio is included in the action policy, but the AWS Glue Studio APIs are not individually identified. That is because when you include glue:UseGlueStudio, you are automatically granted access to the internal APIs without having to specify the individual AWS Glue Studio APIs in the IAM permissions.

In the example, the additional listed action policies (for example, glue:SearchTables) are not AWS Glue Studio APIs, so they will need to be included in the IAM permissions as required. You may also want to include Amazon S3 Proxy actions to specify the level of Amazon S3 access to grant. The example policy below provides access to open AWS Glue Studio, create a visual job, and save/run it if the IAM role selected has sufficient access.

{ "Version": "2012-10-17", "Statement": [ { "Sid": "VisualEditor0", "Effect": "Allow", "Action": [ "glue:UseGlueStudio", "iam:ListRoles", "iam:ListUsers", "iam:ListGroups", "iam:ListRolePolicies", "iam:GetRole", "iam:GetRolePolicy", "glue:SearchTables", "glue:GetConnections", "glue:GetJobs", "glue:GetTables", "glue:BatchStopJobRun", "glue:GetSecurityConfigurations", "glue:DeleteJob", "glue:GetDatabases", "glue:CreateConnection", "glue:GetSchema", "glue:GetTable", "glue:GetMapping", "glue:CreateJob", "glue:DeleteConnection", "glue:CreateScript", "glue:UpdateConnection", "glue:GetConnection", "glue:StartJobRun", "glue:GetJobRun", "glue:UpdateJob", "glue:GetPlan", "glue:GetJobRuns", "glue:GetTags", "glue:GetJob" ], "Resource": "*" }, { "Action": [ "iam:PassRole" ], "Effect": "Allow", "Resource": "arn:aws:iam::*:role/AWSGlueServiceRole*", "Condition": { "StringLike": { "iam:PassedToService": [ "glue.amazonaws.com" ] } } } ] }

Notebook and data preview permissions

Data previews and notebooks allow you to see a sample of your data at any stage of your job (reading, transforming, writing), without having to run the job. You specify an AWS Identity and Access Management (IAM) role for AWS Glue Studio to use when accessing the data. IAM roles are intended to be assumable and do not have standard long-term credentials such as a password or access keys associated with it. Instead, when AWS Glue Studio assumes the role, IAM provides it with temporary security credentials.

To ensure data previews and notebook commands work correctly, use a role that has a name that starts with the string AWSGlueServiceRole. If you choose to use a different name for your role, then you must add the iam:passrole permission and configure a policy for the role in IAM. For more information, see Create an IAM policy for roles not named "AWSGlueServiceRole*".

Warning

If a role grants the iam:passrole permission for a notebook, and you implement role chaining, a user could unintentionally gain access to the notebook. There is currently no auditing implemented which would allow you to monitor which users have been granted access to the notebook.

Amazon CloudWatch permissions

You can monitor your AWS Glue Studio jobs using Amazon CloudWatch, which collects and processes raw data from AWS Glue into readable, near-real-time metrics. By default, AWS Glue metrics data is sent to CloudWatch automatically. For more information, see What Is Amazon CloudWatch? in the Amazon CloudWatch User Guide, and AWS Glue Metrics in the AWS Glue Developer Guide.

To access CloudWatch dashboards, the user accessing AWS Glue Studio needs one of the following:

  • The AdministratorAccess policy

  • The CloudWatchFullAccess policy

  • A custom policy that includes one or more of these specific permissions:

    • cloudwatch:GetDashboard and cloudwatch:ListDashboards to view dashboards

    • cloudwatch:PutDashboard to create or modify dashboards

    • cloudwatch:DeleteDashboards to delete dashboards

For more information for changing permissions for an IAM user using policies, see Changing Permissions for an IAM User in the IAM User Guide.

Review IAM permissions needed for ETL jobs

When you create a job using AWS Glue Studio, the job assumes the permissions of the IAM role that you specify when you create it. This IAM role must have permission to extract data from your data source, write data to your target, and access AWS Glue resources.

The name of the role that you create for the job must start with the string AWSGlueServiceRole for it to be used correctly by AWS Glue Studio. For example, you might name your role AWSGlueServiceRole-FlightDataJob.

Data source and data target permissions

An AWS Glue Studio job must have access to Amazon S3 for any sources, targets, scripts, and temporary directories that you use in your job. You can create a policy to provide fine-grained access to specific Amazon S3 resources.

  • Data sources require s3:ListBucket and s3:GetObject permissions.

  • Data targets require s3:ListBucket, s3:PutObject, and s3:DeleteObject permissions.

If you choose Amazon Redshift as your data source, you can provide a role for cluster permissions. Jobs that run against a Amazon Redshift cluster issue commands that access Amazon S3 for temporary storage using temporary credentials. If your job runs for more than an hour, these credentials will expire causing the job to fail. To avoid this problem, you can assign a role to the Amazon Redshift cluster itself that grants the necessary permissions to jobs using temporary credentials. For more information, see Moving Data to and from Amazon Redshift in the AWS Glue Developer Guide.

If the job uses data sources or targets other than Amazon S3, then you must attach the necessary permissions to the IAM role used by the job to access these data sources and targets. For more information, see Setting Up Your Environment to Access Data Stores in the AWS Glue Developer Guide.

If you're using connectors and connections for your data store, you need additional permissions, as described in Permissions required for using connectors.

Permissions required for deleting jobs

In AWS Glue Studio you can select multiple jobs in the console to delete. To perform this action, you must have the glue:BatchDeleteJob permission. This is different from the AWS Glue console, which requires the glue:DeleteJob permission for deleting jobs.

AWS Key Management Service permissions

If you plan to access Amazon S3 sources and targets that use server-side encryption with AWS Key Management Service (AWS KMS), then attach a policy to the AWS Glue Studio role used by the job that enables the job to decrypt the data. The job role needs the kms:ReEncrypt, kms:GenerateDataKey, and kms:DescribeKey permissions. Additionally, the job role needs the kms:Decrypt permission to upload or download an Amazon S3 object that is encrypted with an AWS KMS customer master key (CMK).

There are additional charges for using AWS KMS CMKs. For more information, see AWS Key Management Service Concepts - Customer Master Keys (CMKs) and AWS Key Management Service Pricing in the AWS Key Management Service Developer Guide.

Permissions required for using connectors

If you're using an AWS Glue Custom Connector and connection to access a data store, the role used to run the AWS Glue ETL job needs additional permissions attached:

  • The AWS managed policy AmazonEC2ContainerRegistryReadOnly for accessing connectors purchased from AWS Marketplace.

  • The glue:GetJob and glue:GetJobs permissions.

  • AWS Secrets Manager permissions for accessing secrets that are used with connections. Refer to Example: Permission to retrieve secret values for example IAM policies.

If your AWS Glue ETL job runs within a VPC running Amazon VPC, then the VPC must be configured as described in Configure a VPC for your ETL job.

Set up IAM permissions for AWS Glue Studio

You can create the roles and assign policies to users and job roles by using the AWS administrator user.

You can use the AWSGlueConsoleFullAccess AWS managed policy to provide the necessary permissions for using the AWS Glue Studio console.

To create your own policy, follow the steps documented in Create an IAM Policy for the AWS Glue Service in the AWS Glue Developer Guide. Include the IAM permissions described previously in Review IAM permissions needed for the AWS Glue Studio user.

Create an IAM Role

AWS Glue Studio needs permissions to access other services on your behalf. You provide those permissions by creating an IAM role and assigning policies to the role. You specify this role when creating jobs, when using the notebook editor, or when using data previews. AWS Glue Studio or your ETL job assumes the role, gaining temporary permissions to access other services and data locations.

You need to grant your IAM role permissions that AWS Glue Studio and AWS Glue can assume when calling other services on your behalf. This includes access to Amazon S3 for storing scripts and temporary files, and any other sources or targets that you use with AWS Glue Studio.

To create a role for your ETL jobs

  1. Sign in to the AWS Management Console and open the IAM console at https://console.aws.amazon.com/iam/.

  2. In the left navigation pane, choose Roles.

  3. Choose Create role.

  4. For role type, choose AWS Service, find and choose Glue, and choose Next: Permissions.

  5. On the Attach permissions policy page, choose the policies that contain the required permissions. For example, you might choose the AWS managed policy AWSGlueServiceRole for general AWS Glue Studio and AWS Glue permissions and the AWS managed policy AmazonS3FullAccess for access to Amazon S3 resources.

  6. Add additional policies as needed for additional data stores or services.

  7. Choose Next: Review.

  8. For Role name, enter a name for your role; for example, AWSGlueServiceRole-Studio. Choose a name that begins with the string AWSGlueServiceRole to allow the role to be passed from console users to the service.

    If you choose a different name for your role, you must add a policy to allow your users the iam:PassRole permission for IAM roles to match your naming convention.

    Choose Create Role to finish creating the role.

Attach policies to the AWS Glue Studio user

Any AWS user that signs in to the AWS Glue Studio console must have permissions to access specific resources. You provide those permissions by using assigning IAM policies to the user.

To attach the AWSGlueConsoleFullAccess managed policy to a user

  1. Sign in to the AWS Management Console and open the IAM console at https://console.aws.amazon.com/iam/.

  2. In the navigation pane, choose Policies.

  3. In the list of policies, select the check box next to the AWSGlueConsoleFullAccess. You can use the Filter menu and the search box to filter the list of policies.

  4. Choose Policy actions, and then choose Attach.

  5. Choose the user to attach the policy to. You can use the Filter menu and the search box to filter the list of principal entities. After choosing the user to attach the policy to, choose Attach policy.

  6. Repeat the previous steps to attach additional policies to the user, as needed.

Create an IAM policy for roles not named "AWSGlueServiceRole*"

To configure an IAM policy for roles used by AWS Glue Studio

  1. Sign in to the AWS Management Console and open the IAM console at https://console.aws.amazon.com/iam/.

  2. Add a new IAM policy. You can add to an existing policy or create a new IAM inline policy. To create an IAM policy:

    1. Choose Policies, and then choose Create Policy. If a Get Started button appears, choose it, and then choose Create Policy.

    2. Next to Create Your Own Policy, choose Select.

    3. For Policy Name, type any value that is easy for you to refer to later. Optionally, type descriptive text in Description.

    4. For Policy Document, type a policy statement with the following format, and then choose Create Policy:

  3. Copy and paste the following blocks into the policy under the "Statement" array.

    { "Action": ["iam:PassRole"], "Effect": "Allow", "Resource": "arn:aws:iam::*:role/AWSGlueServiceRole*", "Condition": { "StringLike": { "iam:PassedToService": ["glue.amazonaws.com"] } } }, { "Effect": "Allow", "Principal": { "Service": ["glue.amazonaws.com"] }, "Action": "sts:AssumeRole" }

    Here is the full example with the Version and Statement arrays included in the policy

    { "Version": "2012-10-17", "Statement": [ { "Action": ["iam:PassRole"], "Effect": "Allow", "Resource": "arn:aws:iam::*:role/AWSGlueServiceRole*", "Condition": { "StringLike": { "iam:PassedToService": ["glue.amazonaws.com"] } } }, { "Effect": "Allow", "Principal": { "Service": ["glue.amazonaws.com"] }, "Action": "sts:AssumeRole" } ] }
  4. To enable the policy for a user, choose Users.

  5. Choose the IAM user to whom you want to attach the policy.

Configure a VPC for your ETL job

You can use Amazon Virtual Private Cloud (Amazon VPC) to define a virtual network in your own logically isolated area within the AWS Cloud, known as a virtual private cloud (VPC). You can launch your AWS resources, such as instances, into your VPC. Your VPC closely resembles a traditional network that you might operate in your own data center, with the benefits of using the scalable infrastructure of AWS. You can configure your VPC; you can select its IP address range, create subnets, and configure route tables, network gateways, and security settings. You can connect instances in your VPC to the internet. You can connect your VPC to your own corporate data center, making the AWS Cloud an extension of your data center. To protect the resources in each subnet, you can use multiple layers of security, including security groups and network access control lists. For more information, see the Amazon VPC User Guide.

You can configure your AWS Glue ETL jobs to run within a VPC when using connectors. You must configure your VPC for the following, as needed:

  • Public network access for data stores not in AWS. All data stores that are accessed by the job must be available from the VPC subnet.

  • If your job needs to access both VPC resources and the public internet, the VPC needs to have a network address translation (NAT) gateway inside the VPC.

    For more information, see Setting Up Your Environment to Access Data Stores in the AWS Glue Developer Guide.

Populate the AWS Glue Data Catalog

AWS Glue Studio can use datasets that are defined in the AWS Glue Data Catalog. These datasets are used as sources and targets for ETL workflows in AWS Glue Studio. If you choose the Data Catalog for your data source or target, then the Data Catalog tables related to your data source or data target must exist prior to creating a job.

When reading from or writing to a data source, your ETL job needs to know the schema of the data. The ETL job can get this information from a table in the AWS Glue Data Catalog. You can use a crawler, the AWS Glue console, AWS CLI, or an AWS CloudFormation template file to add databases and tables to the Data Catalog. For more information about populating the Data Catalog, see Data Catalog in the AWS Glue Developer Guide.

When using connectors, you can use the schema builder to enter the schema information when you configure the data source node of your ETL job in AWS Glue Studio. For more information, see Authoring jobs with custom connectors.

For some data sources, AWS Glue Studio can automatically infer the schema of the data it reads from the files at the specified location.