Skip to main content

Posts

Showing posts from January, 2020

How to fix the error - Status reason CannotStartContainerError: Error response from daemon: OCI runtime create failed: container_linux.go:348: starting container process caused "exec: \"/bootstrap.sh\": permission denied": unknown?

It occurs when you try to create image from your custom Dockerfile, push it in ECR and try to link that image and create an ECS task and run it. The ECS task would fail to run with this error message. This can be fixed by providing necessary permission in your Dockerfile as follows: RUN chmod +x bootstrap.sh # This line should be added CMD ["/bootstrap.sh"] Now, build this Dockerfile and push in ECR. The ECS task utilizing this image will be running successfully now.

How to fix the error - botocore.exceptions.ProfileNotFound: The config profile (AnyProfileName) could not be found?

This occurs when you do aws configure in cmd. It is caused by setting the following environment variable: AWS_PROFILE = AnyProfileName Removing this environment variable is the fix. After removing, if you do aws configure , aws would be configured for the default profile rather than AnyProfileName .

How to install Apache server on Amazon Linux?

Run the following commands to install Apache server on Amazon Linux: SSH on Port 22 sudo su (logs you as root user) yum install httpd -y (installs Apache) service httpd start (starts the service) systemctl httpd status (shows the current status of httpd service) chkconfig httpd on (makes the httpd service to start automatically on instance restart) Load the public ip of the instance in browser. You would see the Apache landing page. If you don't see it, allow port 80 in the inbound rules of the security group associated with the EC2 instance. You should see the Apache start page now.

Can you create an AWS CodePipeline with only 1 stage?

No. There should be a minimum of 2 stages in a pipeline. When you try to create a pipeline with only 1 stage, you would get the following error: Pipeline has only 1 stage(s).  There should be a minimum of 2 stages in a pipeline ( Service: AWSCodePipeline;  Status Code: 400;  Error Code: InvalidStructureException;  Request ID: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)

How to assume a role on target account from login account using MFA Code?

Step 1 : Run the following command and get the temporary credentials. aws sts assume-role \ --role-arn arn:aws:iam::<TargetAccountId>:role/<RoleName> \ --role-session-name <RoleName>  \ --serial-number arn:aws:iam::<LoginAccountId>:mfa/<LoginName>  \ --token-code <6DigitMFACode> Step 2 : The temporary credentials include the following: AccessKeyId SecretAccessKey SessionToken Expiration date and time (this token is valid for 1 hour by default) Copy these values and create a profile in %USERPROFILE%\.aws\credentials file as follows: [PROFILE_NAME] aws_access_key_id = <AccessKeyId> aws_secret_access_key = <SecretAccessKey> aws_session_token = <SessionToken> Step 3 : You can now use this profile to assume <RoleName> role in <TargetAccountId> account.

I am trying to create a bucket 'MyBucket' but I can't. It says bucket with the same name already exists but I could not see any such in my account!

When you try to create a bucket with a name MyBucket (or whatever name), sometimes you would get the following error: deploy-doc-store-s3 already exists and you will not be able to create the bucket. You would search for that bucket in your account but still you would not find it! Then, why are you not able to create MyBucket when a bucket with the same name does not exist in your account? This is because S3 is global. AWS S3 does not require region selection. So, S3 Bucket names need to be globally unique. It occurred because someone else would have created a bucket with the name MyBucket . How to confirm if there already exists a bucket with the name MyBucket? Run the following command: aws s3api head-bucket --bucket MyBucket If it returns, NOTHING i.e, 200 OK - the bucket already exists and you have access to it (the bucket exists in your current account) 403 Forbidden -  the bucket already exists and you don't have access to it...

AWS - Error - An error occurred (ExpiredToken) when calling the DescribeStacks operation: The security token included in the request is expired

Error:   An error occurred (ExpiredToken) when calling the DescribeStacks operation: The security token included in the request is expired. Reason: It occurred when I ran a MAKE command with a profile having expired token (security credentials) Fix: Generate new security credentials (aws sts assume-role) and run the command again