Posts

Showing posts with the label Amazon Web Services

Amazon Redshift - COPY From CSV - Single Double Quote In Row - Invalid Quote Formatting For CSV Error

Answer : It's 2017 and I run into the same problem, happy to report there is now a way to get redshift to load csv files with the odd " in the data. The trick is to use the ESCAPE keyword, and also to NOT use the CSV keyword. I don't know why, but having the CSV and ESCAPE keywords together in a copy command resulted in failure with the error message "CSV is not compatible with ESCAPE;" However with no change to the loaded data I was able to successfully load once I removed the CSV keyword from the COPY command. You can also refer to this documentation for help: http://docs.aws.amazon.com/redshift/latest/dg/copy-parameters-data-conversion.html#copy-escape Unfortunately, there is no way to fix this. You will need to pre-process the file before loading it into Amazon Redshift. The closest options you have are CSV [ QUOTE [AS] 'quote_character' ] to wrap fields in an alternative quote character, and ESCAPE if the quote character is preceded by...

Amazon.Runtime.AmazonServiceException: Unable To Find Credentials

Answer : Create a credentials file at any path where you can access this path from web service application e.g. C:\awsfile\credentials but remember don't give any extension this file File should contains following data. [default] aws_access_key_id=[your_access_key] aws_secret_access_key=[your_secret_key] After this you need to set the path in appsetting tag in the Web.config file: <appSettings> <add key="AWSProfilesLocation" value="C:\awsfile\credentials" /> <add key="AWSRegion" value="us-east-1" /> </appSettings> In AWS Explorer for Visual Studio you can create user profiles that give you different permissions on AWS, then you can choose which profile you want to use in AWS Explorer. These profiles are available only to your Windows user account, if anyone else uses your computer then they will have to create their own profiles. Any software that you run under your user account can also use these profiles. ...

Copy Multiple Files From S3 Bucket

Answer : Also one can use the --recursive option, as described in the documentation for cp command. It will copy all objects under a specified prefix recursively. Example: aws s3 cp s3://folder1/folder2/folder3 . --recursive will grab all files under folder1/folder2/folder3 and copy them to local directory. There is a bash script which can read all the filenames from a file filename.txt . #!/bin/bash set -e while read line do aws s3 cp s3://bucket-name/$line dest-path/ done <filename.txt You might want to use "sync" instead of "cp". The following will download/sync only the files with the ".txt" extension in your local folder: aws s3 sync --exclude="*" --include="*.txt" s3://mybucket/mysubbucket .

Amazon AWS Filezilla Transfer Permission Denied

Answer : To allow user ec2-user (Amazon AWS) write access to the public web directory (/var/www/html), enter this command via Putty or Terminal, as the root user sudo : chown -R ec2-user /var/www/html Make sure permissions on that entire folder were correct: chmod -R 755 /var/www/html Doc's: Setting up amazon ec2-instances Connect to Amazon EC2 file directory using Filezilla and SFTP (Video) Understanding and Using File Permissions if you are using centOs then use sudo chown -R centos:centos /var/www/html sudo chmod -R 755 /var/www/html For Ubuntu sudo chown -R ubuntu:ubuntu /var/www/html sudo chmod -R 755 /var/www/html For Amazon ami sudo chown -R ec2-user:ec2-user /var/www/html sudo chmod -R 755 /var/www/html In my case the /var/www/html in not a directory but a symbolic link to the /var/app/current, so you should change the real directoy ie /var/app/current: sudo chown -R ec2-user /var/app/current sudo chmod -R 755 /var/app/current I hope th...

Amazon RDS Running Out Of Freeable Memory. Should I Be Worried?

Answer : Short answer - you shouldn't worry about FreeableMemory unless it is became really low (about 100-200 Mb) or significant swapping occur (see RDS SwapUsage metric). FreeableMemory is not a MySQL metric, but OS metric. It is hard to give precise definition, but you can treat it as memory which OS will be able to allocate to anyone who request it (in your case it likely will be MySQL). MySQL have a set of settings which are restricting it's overall memory usage to some cap(you can use something like this to actually calculate it). It's unlikely that your instance will ever hit this limit, due to the fact that in general you never reach max number of connections, but this is still possible. Now going back to "decline" in FreeableMemory metric. For the MySQL most of the memory consume by InnoDB buffer pool (see here for details). RDS instances in there config by default have size for this buffer set to 75% of hosts physical memory - which in your case i...

AmazonS3Client(credentials) Is Deprecated

Answer : You can either use AmazonS3ClientBuilder or AwsClientBuilder as alternatives. For S3, simplest would be with AmazonS3ClientBuilder, BasicAWSCredentials creds = new BasicAWSCredentials("access_key", "secret_key"); AmazonS3 s3Client = AmazonS3ClientBuilder.standard().withCredentials(new AWSStaticCredentialsProvider(creds)).build(); Use the code listed below to create an S3 client without credentials: AmazonS3 s3Client = AmazonS3ClientBuilder.standard().build(); An usage example would be a lambda function calling S3. You need to pass the region information through the com.amazonaws.regions.Region object. Use AmazonS3Client(credentials, Region.getRegion(Regions.REPLACE_WITH_YOUR_REGION))

Copy Data From S3 To Local With Prefix

Answer : aws s3 cp s3://my-bucket/ <local directory path> --recursive --exclude "*" --include "<prefix>*" This will copy only files with given prefix The aws s3 cp command will not accept a wildcard as part of the filename (key). Instead, you must use the --include and --exclude parameters to define filenames. From: Use of Exclude and Include Filters Currently, there is no support for the use of UNIX style wildcards in a command's path arguments. However, most commands have --exclude "<value>" and --include "<value>" parameters that can achieve the desired result. These parameters perform pattern matching to either exclude or include a particular file or object. The following pattern symbols are supported. So, you would use something like: aws s3 cp s3://my-bucket-name/ . --include "RAW_TIMESTAMP_0506*" The above answers to not work properly... for example I have many thousands of files in a directo...

Amazon RDS Instance Backup Window Duration?

Answer : Backup window doesn't specifically ask for the time when to start take backup but instead ask for time period in which aws can trigger backup. So basically it's asking for backup window time . That's why it has 2 fields 1. StartTime: When can the process of backup be started. 2. Duration : time window in which process must start to take backup. E.G if I set start time: 5:30 and duration: 30mints Backup can start at anytime between 5:30 to 6:00 . from Working With Backups documentaion Below is the answer for "what if the backup did not fit into a backup window?" If the backup requires more time than allotted to the backup window, the backup continues after the window ends, until it finishes. Below is the answer for "If backup may not fit into the backup window, why do we need a backup window?" The backup window can't overlap with the weekly maintenance window for the DB instance.

Content-type To Be Used For Uploading Svg Images To AWS S3

Answer : As you mentioned, the correct Content-Type for SVG files is "image/svg+xml". Even if the AWS console does not provide that value in the Content-Type selection field, you can enter it anyway and S3 will accept it. AWS specifies the following in their API docs for the Content-Type header: A standard MIME type describing the format of the contents. For more information, go to http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.17. Type: String Default: binary/octet-stream Valid Values: MIME types Constraints: None For additional details see http://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectPUT.html

Configuration Error: Missing Region In Config (AWS)

Answer : The correct code of Oregon region is us-west-2 .You have set it as us-west-2a in two places. While mentioning identity pool id,correct the code as below and try: AWS.config.update({region:'us-west-2'}); var myCredentials = new AWS.CognitoIdentityCredentials({ IdentityPoolId:'us-west-2:"Identity Pool ID"' }); If you are not passing the region for the API CognitoIdentityCredentials , then it will pull the data from AWS.config . Also, In your code, while initializing AWS.CONFIG with region name, You have used us-west-2a . Correct it, if you are going to use it instead of AWS.config.update . var myConfig = new AWS.Config({ credentials: myCredentials, region: 'us-west-2' }); Update I have identified another issue. The issue is that, you are initializing the AWS.config with var myConfig = new AWS.Config() but you are NOT updating the AWS.config class back with it. The missing code is : AWS.config = myConfig . As you are not updat...