How to choose an AWS profile when using boto3 to connect to CloudFront

I think the docs aren’t wonderful at exposing how to do this. It has been a supported feature for some time, however, and there are some details in this pull request. So there are three different ways to do this: Option A) Create a new session with the profile dev = boto3.session.Session(profile_name=”dev”) Option B) Change … Read more

WARNING: UNPROTECTED PRIVATE KEY FILE! when trying to SSH into Amazon EC2 Instance

I’ve chmoded my keypair to 600 in order to get into my personal instance last night, And this is the way it is supposed to be. From the EC2 documentation we have “If you’re using OpenSSH (or any reasonably paranoid SSH client) then you’ll probably need to set the permissions of this file so that … Read more

How to test credentials for AWS Command Line Tools

Use GetCallerIdentity: aws sts get-caller-identity Unlike other API/CLI calls it will always work, regardless of your IAM permissions. You will get output in the following format: { “Account”: “123456789012”, “UserId”: “AR#####:#####”, “Arn”: “arn:aws:sts::123456789012:assumed-role/role-name/role-session-name” } Exact ARN format will depend on the type of credentials, but often includes the name of the (human) user. It uses … Read more

Can’t push image to Amazon ECR – fails with “no basic auth credentials”

if you run $(aws ecr get-login –region us-east-1) it will be all done for you Update July 2021: get-login is now deprecated in version 1 of the AWS CLI. If you’re using version 2 of the AWS CLI, you must use get-login-password. You can pipe the output of get-login-password to your docker login command to … Read more

S3 – Access-Control-Allow-Origin Header

Usually, all you need to do is to “Add CORS Configuration” in your bucket properties. The <CORSConfiguration> comes with some default values. That’s all I needed to solve your problem. Just click “Save” and try again to see if it worked. If it doesn’t, you could also try the code below (from alxrb answer) which … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)