Skip to main content

Posts

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.