codedeploy cannot reach instance service


i want to deploy my express project with ec2, s3 and codedeploy my ec2 version is ubuntu 22.04

this is my IAM user setting Enter image description here

and this is my ec2 IAM setting Enter image description here

and this is my code deploy IAM setting Enter image description here

this is ec2 security setting Enter image description here

I can access to S3 resouce with aws cli, but codeDeploy didn't work.

this is error log.

2023-05-18T15:49:58 ERROR [codedeploy-agent(682)]: InstanceAgent::Plugins::CodeDeployPlugin::CommandPoller: Cannot reach InstanceService: Aws::CodeDeployCommand::Errors::AccessDeniedException - Aws::CodeDeployCommand::Errors::AccessDeniedException

  • did you try restarting your codedeploy agent on ec2 using below command

    service codedeploy-agent restart

  • yes... I've tried restarting codedeploy, I've tried restarting EC2 after IAM setup... I'm so sad

asked 9 months ago569 views
1 Answer


apart trying to restart the agent, I would suggest to look into cloudtrail and see which policy may be missing.

profile picture
answered 9 months ago
  • Is there anything wrong with the current settings? Do I need to set it up on VPC to use codedeploy? I couldn't do anything for three days because of this problem

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions