getting an error when doing code deploy - amazon-web-services

I'm running the following command to do a code deploy from jenkins to EC2 server
aws deploy create-deployment --application-name $APPNAME --s3-location bucket=$S3BUCKET,key=chefdeployment.zip,bundleType=zip --deployment-group-name $DEPLOYMENTGROUPNAME --deployment-config-name CodeDeployDefault.HalfAtATime --description "Deploy" --region us-east-1 --profile $PROFILE --output text
I am getting the following error
A client error (InstanceIdRequiredException) occurred when calling the GetDeploymentInstance operation: Instance ID is Missing.
Has anyone seen this error before?

InstanceIdRequiredException doesn't seem to be an exception that we throw when call create-deployment from CLI.
The exception seems to be thrown when you call get-deployment-instance, and instanceId is required. Here is the doc for reference: http://docs.aws.amazon.com/cli/latest/reference/deploy/get-deployment-instance.html

Related

Error while executing aws eks commands on aws-cli

successfully installed the EKS CLI on the terminal. But when I try to execute the command
aws eks --us-east-1 region update-kubeconfig --name codefresh
it showing an error saying
aws: error: argument command: Invalid choice
It would be great if someone helps me with the proper solution.
You have an error in your call. You specify region with --region us-east-1 and not with --us-east-1 region

How to see the deployment progress via aws cli

I created a deployment using AWS cli:
aws deploy create-deployment --application-name systest1 --deployment-group-name TEST --s3-location bucket=artifacts,bundleType=zip,key=APP.zip
and I got the out as
{
"deploymentId": "d-559F8S41O"
}
How can I see the status of the deployment?? I believe
aws deploy get-deployment
will show us the status but it will not show continuous progress. Actually, I am using AWS cli so use don't have to go on AWS console and check the deployment status instead he will get the result on gitlab-ci output only. Any suggestion??
Use the below CLI command to get the status:
aws deploy get-deployment --deployment-id d-52EZVE6PC --query "deploymentInfo.[status, creator]" --output text

AWS CLI - CodeDeploy Create-Deployment has Unknown Options error

I have a normal CodeDeploy package which is able to deployed using the Console without any issues, but when using the CLI, I get a weird error.
aws deploy create-deployment --application-name MyApp --s3-location bucket=mybucket,key=My.Zip.1.1.1.zip,bundleType=zip --deployment-group-name MyDeploymentGroup --deployment-config-name CodeDeployDefault.OneAtATime --description "This throwns an error"
Running the above, I get the following returned:
usage: aws [options] <command> <subcommand> [<subcommand> ...] [parameters]
To see help text, you can run:
aws help
aws <command> help
aws <command> <subcommand> help
Unknown options: bundleType=zip, key=My.Zip.1.1.1.zip
Weird, since the help does say you need bundleType and key in the s3-location parameter. Just as a test, I remove these unknown options:
aws deploy create-deployment --application-name MyApp --s3-location bucket=mybucket --deployment-group-name MyDeploymentGroup --deployment-config-name CodeDeployDefault.OneAtATime --description "This throwns an error"
Which returns:
--s3-location must specify bucket, key and bundleType.
So, now you know of these options and require them? What is going on here? Am I missing something obvious?
When I ran the code you provided, I got the following returned:
$ aws --version
aws-cli/1.10.60 Python/2.7.11 Darwin/15.6.0 botocore/1.4.50
$ aws deploy create-deployment --application-name ...snip
An error occurred (ApplicationDoesNotExistException) when calling the CreateDeployment operation: No application found for name: MyApp
And this(AWS server side error) is the expected behaviour(I guess).
One possibility that your CLI raised the validation error is that your AWS CLI is out of date.
Which version is your AWS CLI?
I had the same issue. It seemed to be related to the version of PowerShell. It worked on v5, but not on v4.
To fix it, I just put double quotes around the s3-location argument:
aws deploy create-deployment --application-name MyApp --s3-location "bucket=mybucket,key=My.Zip.1.1.1.zip,bundleType=zip" --deployment-group-name MyDeploymentGroup --deployment-config-name CodeDeployDefault.OneAtATime --description "This throwns an error"

AWS CodeDeploy - Error deploying - ApplicationDoesNotExistException

I want to deploy a project in AWS using :
$ aws --region eu-central-1 deploy push --application-name DemoApp --s3-location s3://paquirrin-codedeploy/Project1.zip --ignore-hidden-file --source .
But I got this error:
A client error (ApplicationDoesNotExistException) occurred when calling the RegisterApplicationRevision operation: Applications not found for 289558260222
but the application exists:
$ aws deploy list-applications
{
"applications": [
"DemoApp"
]
}
and CodeDeploy agent is running
[root#ip-171-33-54-212 ~]# /etc/init.d/codedeploy-agent status
The AWS CodeDeploy agent is running as PID 2649
but I haven't found the folder deployment-root inside /opt/codedeploy-agent !
You are deploying to region eu-central-1. But you may not be listing the applications in eu-central-1 using following command:
aws deploy list-applications
Instead, use following command to ensure that application exists:
aws deploy list-applications --region eu-central-1

Why does setting triggers for CodeDeploy deployment group fail with InvalidTriggerConfigException?

I'm trying to set up triggers with awc cli.
According to documentation:
http://docs.aws.amazon.com/codedeploy/latest/userguide/how-to-notify-edit.html
http://docs.aws.amazon.com/codedeploy/latest/APIReference/API_UpdateDeploymentGroup.html
aws deploy update-deployment-group --application-name NAME --deployment-config-name CodeDeployDefault.OneAtATime --current-deployment-group-name TEST --trigger-configurations '[{"triggerName":"TEST-CD","triggerTargetArn":"my:arn","triggerEvents":["DEPLOYMENT_SUCCESS|DEPLOYMENT_FAILURE|INSTANCE_FAILURE"]}]'
aws deploy update-deployment-group --application-name NAME --deployment-config-name CodeDeployDefault.OneAtATime --current-deployment-group-name TEST --trigger-configurations '[{"triggerName":"TEST-CD","triggerTargetArn":"my:arn","triggerEvents":["DEPLOYMENT_SUCCESS"]}]'
aws deploy update-deployment-group --application-name NAME --deployment-config-name CodeDeployDefault.OneAtATime --current-deployment-group-name TEST --trigger-configurations '[{"triggerName":"TEST-CD","triggerTargetArn":"my:arn","triggerEvents":{"DEPLOYMENT_SUCCESS"}}]'
But i'm not able to do this. Reciving following errors:
A client error (InvalidTriggerConfigException) occurred when calling
the UpdateDeploymentGroup operation: Invalid Trigger event type
Here is how to do it properly:
https://forums.aws.amazon.com/thread.jspa?threadID=228103