zanderwar
zanderwar

Reputation: 3730

Codedeploy with S3 always fails after 5 minutes

I've spent the better half of the day trying to setup CodeDeploy, CodePipeline, S3 and EC2.

Codepipeline will successfully:

Also

  1. EC2 has list and read access to S3
  2. S3 allows all actions from EC2

I've followed this outdated guide mostly: https://cloudacademy.com/blog/how-to-deploy-application-code-from-s3-using-aws-codedeploy/

appspec.yml

version: 0.0
os: linux
files:
  - source: /
    destination: /var/www

hooks:
  AfterInstall:
    - location: hooks/after-install.sh
      runas: root

I'm rather new to AWS and can't for my life find where the logs are telling me what's going on, nor do I get any error message that points me anywhere, so I've literally been shooting blind double checking everything all day and trying again and this is taunting me now:

enter image description here enter image description here

Any help even if it's pointing me towards where I can actually find the error message would be tremendously appreciated, thanks for your time

Upvotes: 2

Views: 295

Answers (1)

Chris Williams
Chris Williams

Reputation: 35188

This generally occurs for one of the following 3 reasons:

  • The CodeDeploy agent needs to be installed and running on the target instance.
  • No access to CodeDeploy and S3 service. Either ensure you are:
    • Running an instance in a public subnet with an internet gateway
    • Running an instance in a private subnet with a NAT gateway/NAT instance
  • The IAM permissions for the IAM role of the instance are not sufficient, for sufficient permissions attach the AWSCodeDeployRole policy.

As you have said your IAM role permissions are fine you are left with one of the other 2 scenarios.

Once these are working you can generally see the logs within the /var/log/aws/codedeploy-agent location.

Upvotes: 2

Related Questions