Amazon Redshift Serverless - Amazon Redshift
Amazon Redshift Serverless - Amazon Redshift
html
1. Open https://portal.aws.amazon.com/billing/signup
(https://portal.aws.amazon.com/billing/signup) .
1 of 13 4/25/2024, 2:56 PM
Amazon Redshift Serverless - Amazon Redshift https://docs.aws.amazon.com/redshift/latest/gsg/new-user-serverless.html
tasks.html) .
2 of 13 4/25/2024, 2:56 PM
Amazon Redshift Serverless - Amazon Redshift https://docs.aws.amazon.com/redshift/latest/gsg/new-user-serverless.html
3 of 13 4/25/2024, 2:56 PM
Amazon Redshift Serverless - Amazon Redshift https://docs.aws.amazon.com/redshift/latest/gsg/new-user-serverless.html
2. If you're launching query editor v2 for the first time, you must
configure AWS KMS encryption before you can proceed. Optionally,
you can also specify the URI to an S3 bucket for data loading later.
After doing so, choose Configure account.
4 of 13 4/25/2024, 2:56 PM
Amazon Redshift Serverless - Amazon Redshift https://docs.aws.amazon.com/redshift/latest/gsg/new-user-serverless.html
5 of 13 4/25/2024, 2:56 PM
Amazon Redshift Serverless - Amazon Redshift https://docs.aws.amazon.com/redshift/latest/gsg/new-user-serverless.html
Once you are connected, you can choose to load sample data from
Amazon Redshift Serverless or from an Amazon S3 bucket.
5. Under the Amazon Redshift Serverless default workgroup, expand
the sample_data_dev database. There are three sample schemas
corresponding to three sample datasets that you can load into the
Amazon Redshift Serverless database. Choose the sample dataset
that you want to load, and choose Open sample notebooks.
6. When loading data for the first time, query editor v2 will prompt
you to create a sample database. Choose Create.
6 of 13 4/25/2024, 2:56 PM
Amazon Redshift Serverless - Amazon Redshift https://docs.aws.amazon.com/redshift/latest/gsg/new-user-serverless.html
You can also export the results as a JSON or CSV file or view the
results in a chart.
You can also load data from an Amazon S3 bucket. See Loading in data
from Amazon S3 (#serverless-load-data-from-s3) to learn more.
At this point, you have a database named dev . Next, you will create
some tables in the database, upload data to the tables, and try a query.
For your convenience, the sample data that you load is available in an
Amazon S3 bucket.
1. Before you can load data from Amazon S3, you must first create an
IAM role with the necessary permissions and attach it to your
7 of 13 4/25/2024, 2:56 PM
Amazon Redshift Serverless - Amazon Redshift https://docs.aws.amazon.com/redshift/latest/gsg/new-user-serverless.html
2. Expand the Manage IAM roles menu, and choose Create IAM role.
3. Choose the level of S3 bucket access that you want to grant to this
role, and choose Create IAM role as default.
8 of 13 4/25/2024, 2:56 PM
Amazon Redshift Serverless - Amazon Redshift https://docs.aws.amazon.com/redshift/latest/gsg/new-user-serverless.html
4. Choose Save changes. You can now load sample data from
Amazon S3.
9 of 13 4/25/2024, 2:56 PM
Amazon Redshift Serverless - Amazon Redshift https://docs.aws.amazon.com/redshift/latest/gsg/new-user-serverless.html
3. Create tables.
If you are using the query editor v2, copy and run the following
create table statements to create tables in the dev database. For
more information about the syntax, see CREATE TABLE
(https://docs.aws.amazon.com/redshift/latest
/dg/r_CREATE_TABLE_NEW.html) in the Amazon Redshift Database
Developer Guide.
10 of 13 4/25/2024, 2:56 PM
Amazon Redshift Serverless - Amazon Redshift https://docs.aws.amazon.com/redshift/latest/gsg/new-user-serverless.html
starttime timestamp);
4. In the query editor v2, create a new SQL cell in your notebook.
COPY users
FROM 's3://redshift-downloads/tickit
/allusers_pipe.txt'
DELIMITER '|'
TIMEFORMAT 'YYYY-MM-DD HH:MI:SS'
IGNOREHEADER 1
REGION 'us-east-1'
IAM_ROLE default;
COPY event
FROM 's3://redshift-downloads/tickit
11 of 13 4/25/2024, 2:56 PM
Amazon Redshift Serverless - Amazon Redshift https://docs.aws.amazon.com/redshift/latest/gsg/new-user-serverless.html
/allevents_pipe.txt'
DELIMITER '|'
TIMEFORMAT 'YYYY-MM-DD HH:MI:SS'
IGNOREHEADER 1
REGION 'us-east-1'
IAM_ROLE default;
COPY sales
FROM 's3://redshift-downloads/tickit
/sales_tab.txt'
DELIMITER '\t'
TIMEFORMAT 'MM/DD/YYYY HH:MI:SS'
IGNOREHEADER 1
REGION 'us-east-1'
IAM_ROLE default;
6. After loading data, create another SQL cell in your notebook and
try some example queries. For more information on working with
the SELECT command, see SELECT (https://docs.aws.amazon.com
/redshift/latest/dg/r_SELECT_synopsis.html) in the Amazon Redshift
View relatedGuide.
pagesToPreview 1 2 3 4
Developer understand the sample data's structure and
schemas, explore using the query editor v2.
Redshift › gsg Toolkit-for-vscode ›… Cur › userguide
Step--4: Find
Load top 10 buyers
Working
by with
quantity. Creating an
dataSELECT
from… firstname, Amazon Athena table…
… total_quantity
lastname,
FROM (SELECT buyerid, sum(qtysold)
April 1, 2024 January 19, 2024 January 19, 2024
total_quantity
FROM sales
GROUP BY buyerid 1 2 3 4
Discover highly rated pages Preview
ORDER BY total_quantity desc limit 10)
Q, users
WHERE
Redshift Q.buyerid = Redshift
› mgmt userid › mgmt Redshift › dg
Configuring
ORDER BYanQ.total_quantity
Amazon desc; CREATE TABLE
ODBC… Redshift… (https://docs.a…
-- Find events in the 99.9 percentile in terms
April 1, 2024 April 20, 2024 January 19, 2024
of all time gross sales.
SELECT eventname, total_price
FROM (SELECT eventid, total_price, ntile(1000)
© 2024, over(order by total_price
Amazon Web Services, Inc. or its affiliates. desc)
All rights as percentile
reserved.
FROM (SELECT eventid, sum(pricepaid)
12 of 13 4/25/2024, 2:56 PM
Amazon Redshift Serverless - Amazon Redshift https://docs.aws.amazon.com/redshift/latest/gsg/new-user-serverless.html
13 of 13 4/25/2024, 2:56 PM