Error while executing aws eks commands on aws-cli - amazon-web-services

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

Related

aws emr cli failed for InvalidRequestException

I was able to run the create-cluster cli successfully and launched my EMR cluster, but when I tried to run below command to add a step:
aws emr add-steps --cluster-id j-your-cluster-id --steps Type=CUSTOM_JAR,Name=CustomJAR,ActionOnFailure=CONTINUE,Jar=s3://mybucket/mytest.jar,Args=arg1,arg2,arg3 Type=CUSTOM_JAR,Name=CustomJAR,ActionOnFailure=CONTINUE,Jar=s3://mybucket/mytest.jar,MainClass=mymainclass,Args=arg1,arg2,arg3 --profile my-test-account
it failed with this error:
An error occurred (InvalidRequestException) when calling the DescribeCluster operation: Cluster id 'j-your-cluster-id' is not valid.
and I've double checked j-your-cluster-id is matching my cluster-id exactly.
I feel like this is a permission issue, but how come the same profile could let me create a cluster, but cannot let me describe it?
How can I dig further and fix this please?
Based on the comments.
The issue was caused by execution AWS CLI in different region than intended. The solution was to use --region option to provide correct region for the CLI.

Unable to create a fargate profile for the AWS EKS cluster

I have an AWS EKS cluster named xyz-cicd in the regios Ohio(us-east-2) which I had created using the eksctl command like below:-
eksctl create cluster --name xyz-cicd --region us-east-2 --fargate
It took some time to create a cluster with a default profile however I want to create a new profile for the same cluster so I ran the following command which is giving me an error:-
vinod827#Vinods-MacBook-Pro cicd % eksctl create fargateprofile \
--cluster xyz-cicd \
--name cicd \
--namespace cicd
Error: fetching cluster status to determine operability: unable to describe cluster control plane: ResourceNotFoundException: No cluster found for name: xyz-cicd.
{
RespMetadata: {
StatusCode: 404,
RequestID: "c12bd05c-3eb6-40bf-a972-f1cba139ea9a"
},
Message_: "No cluster found for name: xyz-cicd."
}
vinod827#Vinods-MacBook-Pro cicd %
Please note there is no issue with the cluster name or region. The cluster does exists in this same region but not sure why the eksctl command is returning the error stating no cluster found with the same name. I can schedule a pod on the default profile if that were the case. Please advise, thanks
Your second command is missing the region parameter and therefore probably using a different region. That is why it not finding your cluster.

aws ecs-cli extra-user-data: flag provided but not defined

I'm facing a strange problem trying to configure a AWS ECS cluster through ecs-cli.
To be specific, if I use the flag --extra-user-data it says: flag provided but not defined.
here's my command syntax:
ecs-cli up --capability-iam --keypair test --size 1 --instance-type t2.small --extra-user-data file://init-ec2 --launch-type EC2 --force --cluster test --region eu-west-1
Here's the exception:
ERRO[0000] flag provided but not defined: -extra-user-data
Any help is appreciated...
--extra-user-data was released in version 1.9.0 of ecs-cli. The error message you've provided appears to indicate that you're running a previous version. Update to the latest version of ecs-cli and try again.

NoSuchBucket error when running Kubernetes on AWS

Downloaded Kubernetes 1.1.8 from:
https://github.com/kubernetes/kubernetes/releases/download/v1.1.8/kubernetes.tar.gz
Followed the instructions at:
https://github.com/kubernetes/kubernetes/blob/master/docs/getting-started-guides/aws.md
And got the following error:
kubernetes-1.1.8 > ./kubernetes/cluster/kube-up.sh
... Starting cluster using provider: aws
... calling verify-prereqs
... calling kube-up
Starting cluster using os distro: vivid
Uploading to Amazon S3
Creating kubernetes-staging-0eaf81fbc51209dd47c13b6d8b424149
make_bucket: s3://kubernetes-staging-0eaf81fbc51209dd47c13b6d8b424149/
A client error (NoSuchBucket) occurred when calling the GetBucketLocation operation: The specified bucket does not exist
+++ Staging server tars to S3 Storage: kubernetes-staging-0eaf81fbc51209dd47c13b6d8b424149/devel
usage: aws [options] <command> <subcommand> [<subcommand> ...] [parameters]
To see help text, you can run:
aws help
aws <command> help
aws <command> <subcommand> help
aws: error: argument --region: expected one argument
AWS Console showed that the bucket was created but was empty.
It's probably a region issue; I'm guessing that the bucket is created in another region than Kubernetes tries to access.
Looks like the aws cmdline tool is confused about the region:
aws: error: argument --region: expected one argument
When it can't determine the region, it defaults to one of the us regions.
EDIT: the S3 sync is triggered by script cluster/aws/util.sh.
The command executed is aws s3 sync --region ${s3_bucket_location} --exact-timestamps ${local_dir} "s3://${AWS_S3_BUCKET}/${staging_path}/".
You can add an echo ${s3_bucket_location} before the line above. It should give you more information on what the region is set to.

getting an error when doing code deploy

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