Namran Hussin AWS,Cloud Computing How to install aws-cli and configure it with AWS_SECRET_KEY for the first time

How to install aws-cli and configure it with AWS_SECRET_KEY for the first time

Let’s say you have an account in Amazon Web Services (AWS) and got some instance running under an Elastic Container Services (ECS).
You had it running OK, until suddenly got the bills charging for the CloudWatch usage.

You go in the AWS console and checked the way to disable the Container Insight for the running ECS, and found out there is no button for that.
And need to use aws-cli command as below to disable it.

aws ecs update-cluster-settings --cluster ${clustername} --settings name=containerInsights,value=disabled --region ${AWS_REGION}

And then realised you don’t have aws-cli to run in local at the moment.

 

Here is how to install the aws-cli in the local machine and get the AWS_SECRET_KEY for the first time.

You start to install it with the following instruction.

curl "https://awscli.amazonaws.com/AWSCLIV2.pkg" -o "AWSCLIV2.pkg"

sudo installer -pkg AWSCLIV2.pkg -target

 

Then verify the installation is correct with

which aws

it correct it would return the following string

/usr/local/bin/aws

and also

aws --version aws-cli/2.1.13 Python/3.7.4 Darwin/19.6.0 exe/x86_64 prompt/off

After that you need to configure it for the first time using the following command

aws configure

it will prompt to enter the AWS ID, AWS SECRET KEY and region.

You can find this information from the AWS IAM -> Roles -> Security Credentials.

Once logged,

it will create a file under the following folder

~/.aws/config

[default]

region = Singapore

output = json

 

~/.aws/credential

aws_access_key_id = xxx

aws_secret_access_key = yyyy

 

 

after that you can use to disable the container insight with the following command

export AWS_REGION=ap-southeast-1 export clustername=wp-namran aws ecs update-cluster-settings --cluster ${clustername} --settings name=containerInsights,value=disabled --region ${AWS_REGION}

 

response

 

Verify again at the console.

 

Done, that’s all for now.

refs:

https://docs.aws.amazon.com/cli/latest/userguide/cli-services-iam-create-creds.html

https://ecsworkshop.com/container_insights/cleanup/

 

294 thoughts on “How to install aws-cli and configure it with AWS_SECRET_KEY for the first time”

  1. whoah this blopg is faqntastic i lile readiing youur articles.
    Stay up tthe gopod work! Youu understand, lots off persdons are searching around ffor this
    info, youu could help them greatly.

  2. Excellenjt itedms from you, man. I have berar inn mind your
    stuff previous to annd you’re somply ttoo magnificent. I actuallly like what you’ve bought here, certainly likke wuat
    you aree saying annd thhe way during which yoou asdsert it.
    Youu make itt entertaining and yoou contionue tto taqke are
    oof to stay it sensible. I can’t wzit tto learn mhch mire frim you.

    That iis actually a wonhderful webb site.

  3. Greettings fropm Colorado! I’m bred to teaars att work soo I decided too check oout your blog on my iphne during lunc break.I enjoy the inmfo
    youu presennt here and can’t waiut tto take a look whben I get home.
    I’m shocked at how fast youur blog loaded oon mmy mobnile ..
    I’m nnot evesn using WIFI, just 3G .. Anyways, awessome site!

  4. Someonje necessarily hedlp tto make seriously poss I’d state.
    This iss thhe fiorst time I frequented your website ppage and thus far?

    I surprissed with thhe reseasrch you made too mke his actyal put uup
    incredible. Excellent task!

  5. Hi there, juust became aware off your bog through Google,
    and found tuat it is really informative. I’m gohna watch out for
    brussels. I wil appreciate if yoou cohtinue thks
    in future. Numnerous peoople will bbe benefitedd from your writing.
    Cheers!

  6. I don’t know whethesr it’s juszt mme or iif everyone else experiencing isesues wth
    your blog. It appears like som oof thee writte text witfhin youhr
    posts are runnijng off tthe screen. Cann somebody else pease comkment and let me knpw if this iis happenjng to thdm ass well?
    Thiss might bee a issuhe wiuth my web browwser becaus I’ve hadd tis happen before.
    Cheers

  7. I havee been surfting online greeater than thrdee hours aas off late, buut
    I never discoered any attention-grabbing article like yours.
    It is pretty worth enough foor me. In myy opinion, if
    alll webmaters and blggers made juswt rjght ccontent ass yoou probably
    did, tthe weeb can bbe mmuch more helpful thyan ever before.

  8. I loved as much aas yyou wioll receive carried out righ here.
    The sketch iis attractive, youur authored subject matter
    stylish. nonetheless, youu command get got an shakiiness oveer thgat yoou wish be deliverijng the following.
    unwell unquhestionably come furthrr formerly gain since exactly the same neadly very oten insiide ccase you shield this hike.

  9. It iis perfecct ttime to make sone plan forr thee future annd it’s tim tto be happy.
    I’ve leearn tis put up and if I could I wish
    to suggest yyou ffew fascinafing things oor tips.
    Maye yoou caan writfe nexxt articles relating to thhis article.
    I wish tto reazd more issjes approximately it!

  10. Superb weebsite yoou hhave here butt I wwas curious iif youu
    knjew of anny community fforums that covr thee sawme topics discussed here?
    I’d really like to bee a parrt of comunity whhere I can gett
    comments from otheer experirnced individuqls that shre the same interest.
    If yoou have anyy recommendations, please let mee know.
    Kudos!

  11. Greetings I amm sso glkad I found yourr site, I really found you by mistake, hile
    I wass seazrching on Digg ffor something else, Regardless I aam hhere nnow aand would just liike too say thanis for a remarkable post aand a aall rouund enjoyable log (I
    aalso love the theme/design), I don’t have time too ggo througgh iit alll aat thee moment but I have book-marked itt and aleo aded
    your RSS feeds, sso when I have tiime I willl be back tto read a great deal more,
    Plwase ddo kerep upp thhe fantastic b.

  12. Prewtty elemesnt off content. I just stumbled upon your blog annd inn accession capital too asserdt thqt I geet iin act enjnoyed account your weblog posts.
    Any way I wiill bbe subscribing too youhr augment and eeven I successs you geet admission to persistently fast.

  13. Doess yourr website hasve a conjtact page?
    I’m having troublle locating itt but, I’d lke too send yyou an e-mail.
    I’ve got some suggestions foor yopur blog you might bee intersted in hearing.
    Either way, greazt site and I look forfward to seeing itt grdow ver time.

  14. Please let me kbow if you’re lookng forr a wrier
    for your site. You hhave sme reaally good articless and I believe I would bbe a good asset.
    If yyou ever want to takee some of the load off, I’d loce too write soke artifles
    forr your blog in exchhange for a linkk badk too mine.
    Plesse blastt me an email iif interested. Regards!

  15. Does yopur websitre have a contaact page? I’m haing prooblems llocating
    it but, I’d ike to shooot yoou an e-mail. I’ve gott some recommendations for ypur blog you might be interested in hearing.
    Either way, great site and I llook forard to seeimg iit debelop over time.

  16. Howdy!This is mmy firt comment here so I jhst wwnted too give a quick shoiut out and teol yoou I truly enmjoy reading through youur blog posts.
    Cann you suggest anny other blogs/websites/forums tthat go oover the
    ssme topics? Thanks!

  17. Greetings, I think yyour website could possibly bbe having intternet browser compatiibility issues.

    Whenever I look att yoour website inn Safari, iit looks fine hoever
    whhen opening inn Internet Explorer, it has some overlaplping issues.
    I just wanted too ggive yoou a quick hewds up!
    Bsides that, fantastic website!

  18. It iis the best time to make a feew plans for tthe futur annd it is time to be
    happy. I have read tthis pput upp and iif I mmay I wamt
    too recommend you ffew fascinatin issues or
    suggestions. Maybe yoou could write next articlers eferring to
    this article. I want too learn more issues approximately
    it!

  19. Whenn I originally commdnted I clickrd tthe “Notify me when new comments are added” checkbox and now
    ech time a omment is adcded I gett sevveral e-mails wwith thee sawme comment.
    Is therfe any way yyou caan remove pdople fromm thjat service?
    Thank you!

Comments are closed.

Related Post