Skip to main content

Posts

Showing posts from 2022

Allow others to upload files in your Amazon S3 bucket

  Allow others to upload files in your Amazon S3 bucket Let us explore how can we allow others to upload files in our AWS account using AWS console 01. Create user - Login to to AWS console --> Select IAM --> Users --> Add User --> Username -->  Password   02. Create Amazon s3 bucket --> Select S3 --> Create Bucket --> Bucket Name --> Create Bucket Note:  Keep Check Box Checked for Block All public Access, and other options as default.   03. Create Amazon s3 bucket policy --> Select Bucket --> Bucket Policy --> Edit --> Add following bucket policy as follows. Note: Make sure to replace Bucke_Name with your actual bucket name. {     "Version": "2012-10-17",     "Statement": [         {             "Sid": "AllowToListBucket",             "Effect": "Allow",             "Principal": {                 "AWS": "arn:aws:iam::<YourAmzon 12 Digit A/c No.>

Find out S3 Bucket URL

 Find out S3 Bucket URL  Amazon supports   01. Virtual hosted-style URL 02. path-style URLs Virtual hosted-style URL -    https://bucket-name.s3.region-code.amazonaws.com/<file-name> Path-style URL -  https://s3.region-code.amzonaws.com/bucket-name/file-name But what is the easiest way to find out the bucket URL from AWS console 01. Create bucket in S3   02. Create folder inside the bucket   03. Check / select folder on the left most side of the folder       04. Select  Copy URL This URL will be the hosted-style URL of the folder test in your bucket, which is in us-west-1 region https://<bucket-name>.s3.us-west-1.amazonaws.com/test/ Ref.: https://docs.aws.amazon.com/AmazonS3/latest/userguide/access-bucket-intro.html  

Amazon Redshift Daily Command

Amazon Redshift Daily: SELECT CURRENT_AWS_ACCOUNT; SELECT CURRENT_DATABASE(); SELECT CURRENT_NAMESPACE(); SELECT CURRENT_SCHEMA(); SELECT CURRENT_USER_ID(); SELECT CURRENT_USER; -- Metadata select distinct(nspname) from pg_catalog.pg_namespace where nspname not like 'pg_temp%'; -- Describe Table select * from information_schema.columns where table_name='columns'; select column_name, data_type, character_maximum_length from information_schema.columns where table_name='columns'; -- Create Read-only Group Create group ro_group; -- Create User Crate user ro_user with password <password>; -- Add user to Read-only Group alter group ro_group ADD user ro_user; -- Grant Usage permission to Read-Only Group to specific schema grant usage on schema "ro_schema" to group ro_group; -- Grant select permisson to read-only group to specific schema grant select on all tables in schema "ro_schema" to group "ro_group"; -- Alter default privileges

Confugure SSH Tunnel with Putty for Windows and MacOS

Configure SSH tunnel for Putty: Here we are going to configure SSH tunnel to connect Amazon bastian host for Amazon Redshit. The purpose of this configuration is to open tunnel, so if you have Python script to validate data, you can execute it either on command prompt or using PyCharm. This configuration is application to Windows env.  Select session 01. Host Name: LunuxID@global-consumer-np-bastian host.subdomain.domain.com 02. Port: 22 03. Connection type: SSH 04. Save Session: RS Dev Under Connection --> SSH --> Tunnels -->  01. Source port - 5439 02. Destination - global-consumer-np-rs.subdomain.domain.com:5439 It will add the value as follows L5439     global-consumer-np-subdomain.domain.com:5439 For Mac OS: 01. Open terminal window 02. Type the following command  ssh -L 5439:global-consumer-np-rs-.subdomain.domain.com:5439 LinuxID@global-consumer-np-bastion.subdomain.domin.com -N