0

im trying to do autoscalling with memory utilization. i have created a subnet where auto assign public ip is disabled but route to IGW is attached.

I ran below script but cloudwatch agent is not downloaded on the server.

Fn::Sub': >
      #!/bin/bash





      rpm -Uvh
      https://s3.amazonaws.com/amazoncloudwatch-agent/amazon_linux/amd64/latest/amazon-cloudwatch-agent.rpm

      /opt/aws/bin/cfn-init -v --stack ${AWS::StackId} --resource
      ASGLaunchConfiguration --region ${AWS::Region} --configsets default

      /opt/aws/bin/cfn-signal -e $? --stack ${AWS::StackId} --resource

I also exported the proxy details still no sucess.Due to this cloudwatch alarm stays in insufficient data

Later on I added proxy server , still cloudwatch agent was not downloaded

!Base64 
    'Fn::Sub': >
      #!/bin/bash

      export https_proxy=10.20.10.5:8080

      rpm -Uvh
      https://s3.amazonaws.com/amazoncloudwatch-agent/amazon_linux/amd64/latest/amazon-cloudwatch-agent.rpm

      /opt/aws/bin/cfn-init -v --stack ${AWS::StackId} --resource
      ASGLaunchConfiguration --region ${AWS::Region} --configsets default

      /opt/aws/bin/cfn-signal -e $? --stack ${AWS::StackId} --resource
      ASGLaunchConfiguration --region ${AWS::Region}

any suggestion ?

  • Can you login to the instance and check if you can manually download the agent? – Marcin Jun 12 '20 at 07:00
  • after ssh to the instance ,we are exporting the proxy and then we can download the agent.but we want it to happen on its own – chandni mirchandani Jun 12 '20 at 07:02
  • What proxy? In your UserData there is no indication of any proxy? – Marcin Jun 12 '20 at 07:06
  • i "Fn::Sub": "#!/bin/bash\nmount -av\nexport https_proxy=10.20.10.5:8080\napachectl -k restart\nrpm -Uvh https://s3.amazonaws.com/amazoncloudwatch-agent/amazon_linux/amd64/latest/amazon-cloudwatch-agent.rpm\n/opt/aws/bin/cfn-init -v --stack ${AWS::StackId} --resource ASGLaunchConfiguration --region ${AWS::Region} --configsets default\n/opt/aws/bin/cfn-signal -e $? --stack ${AWS::StackId} --resource ASGLaunchConfiguration --region ${AWS::Region}\n" – chandni mirchandani Jun 12 '20 at 07:08
  • Can you update your question with the relevant information? – Marcin Jun 12 '20 at 07:09
  • done,let me know if you need more details. subnet do not have public ip but igw is attached. – chandni mirchandani Jun 12 '20 at 07:18
  • 1
    The log file for User Data execution can be found at: `/var/log/cloud-init-output.log` Please let us know if it contains any relevant information. – John Rotenstein Jun 12 '20 at 07:25
  • Is this exact copy of user data? The line breaks you have in `cfn-init` and `cfn-signal` are due to SO formatting? – Marcin Jun 12 '20 at 07:30
  • This script will install the CloudWatch agent, trigger the configSet ‘Default’ and pass the cfn-init return status to cfn-signal. – chandni mirchandani Jun 12 '20 at 08:48

0 Answers0