Lightsail and CodeDeploy: Invalid on premises config file

0

Hello, I'm trying to integrate a lightsail instace running Ubuntu 22 with CodeDeploy. Tried a couple of this but the logs keep saying the my config file format is invalid. I tried removing the spaces between key and values, din't seem to work. Is there a way to troubleshoot what could be wrong with the file?

Config file /etc/codedeploy-agent/conf/codedeploy.onpremises.yml:

aws_access_key_id:*** aws_secret_access_key:*** iam_user_arn:***

Outpu from /var/log/aws/codedeploy-agent/codedeploy-agent.log 2024-02-07T18:25:38 INFO [codedeploy-agent(2748)]:mstr 2748: Spawned child 1/1 2024-02-07T18:25:38 ERROR [codedeploy-agent(3356)]: Invalid on premises config file 2024-02-07T18:25:38 ERROR [codedeploy-agent(3356)]: booting child: error during start or run: RuntimeError - The deployment failed because the format of the following on-premises configuration file is invalid: /etc/codedeploy-agent/conf/codedeploy.onpremises.yml - /opt/codedeploy-agent/lib/instance_agent/plugins/codedeploy/onpremise_config.rb:15:in `rescue in configure'

Marco
asked 3 months ago198 views
2 Answers
0

Hello.

Please mask the contents listed in "aws_access_key_id" and "aws_secret_access_key".

Did you restart CodeDeploy Agent after updating "codedeploy.onpremises.yml"?
Looking at the documentation, the configuration seems correct.
https://docs.aws.amazon.com/codedeploy/latest/userguide/register-on-premises-instance-iam-user-arn.html#register-on-premises-instance-iam-user-arn-4

profile picture
EXPERT
answered 3 months ago
  • Hi, yes, I restarted the codedeploy agent. Looking for some yml validator it suggested to remove the space between key and value, didn't worked. I keep seeing the same error.

    https://www.yamllint.com/

0

Online guidance indicates you need at least a 5 line file as found below. Your reference file appears to be missing the initial line of "---" along with a region value. Please let us know if adding to your file per below resolves your issue or not.

Reference (found in earlier responses as well): https://docs.aws.amazon.com/codedeploy/latest/userguide/register-on-premises-instance-iam-user-arn.html#register-on-premises-instance-iam-user-arn-4

---
aws_access_key_id: secret-key-id
aws_secret_access_key: secret-access-key
iam_user_arn: iam-user-arn
region: supported-region

secret-key-id is the corresponding IAM user's secret key ID you noted in Step 1: Create an IAM user for the on-premises instance or Step 3: Get the IAM user credentials.

secret-access-key is the corresponding IAM user's secret access key you noted in Step 1: Create an IAM user for the on-premises instance or Step 3: Get the IAM user credentials.

iam-user-arn is the IAM user's ARN you noted earlier in Step 1: Create an IAM user for the on-premises instance.

supported-region is the identifier of a region supported by CodeDeploy where your CodeDeploy applications, deployment groups, and application revisions are located (for example, us-west-2). For a list of regions, see Region and endpoints in the AWS General Reference.

AWS
MODERATOR
answered 3 months ago

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