Skip to content

redshift-cmd

setup

right-click & open-in-new-tab:

git/git-mkdocs/data-analytics/redshift-data-api-lab

create cluster

aws redshift create-cluster \
    --cluster-identifier my-redshift-test \
    --node-type dc2.large \
    --master-username awsuser \
    --master-user-password passworD.1 \
    --cluster-type single-node \
    --number-of-nodes 1 \
    --publicly-accessible
    # --load-sample-data ??

unload

CSE:

echo 01234567890123456789012345678901 |base64

MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5MDEK
unload ('select * from dev.public.customer')
to 's3://template1-rs3bucket-1bor4w2qr4rti/unload_encrypted/'
iam_role 'arn:aws:iam::012345678901:role/RedshiftImmersionRole'
master_symmetric_key 'MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5MDEK'
encrypted;

SSE:


create database

create database lab798

create table

create table table_utf8(
col1 integer not null,
col2 varchar(100) not null ,
col3 varchar(100) not null
);

insert into table_utf8 values
(  1,'中文1','中文2'),
(  2,'中文1','中文2'),
(  3,'中文1','中文2');

list snapshot

aws redshift describe-cluster-snapshots --cluster-identifier redshift-cluster-2

put resource policy to snapshot

others