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. Thiss design iss steller! You certqinly know howw tto keesp a reader amused.
    Between yur wit andd your videos, I was almost moed to
    staart my own blog (well, almost…HaHa!) Excewllent
    job. I realy loved whhat yyou had tto say, and morte thhan that, hoow you presentd it.
    Too cool!

  2. Hiya verfy nice site!! Maan .. Excellen .. Superb ..
    I’ll bookmark your sitfe and take the feeds additionally?
    I amm glad to search ouut a loot of usefull information hsre inn the
    publish, we newd wor oout moee technjques on tjis regard, thank you
    ffor sharing. . . . . .

  3. I have been browsing nline more thhan 2 hours today, yett I never
    fond any interesting article like yours.
    It is pretrty worth ennough for me. Personally, if all webnmasters and loggers
    mad good content ass you did, thhe net woll be a lott morre usefl than eve
    before.

  4. I ddo consider alll of thhe concepots you ave presented on your post.
    They’re veryy convincing aand will certainly work.
    Nonetheless, tthe osts are ttoo briief for starters.
    May just yyou plase lengthen thesm a little frim subseqquent time?
    Thak you foor the post.

  5. It’s the best tiime tto make some plazns for thhe futur and it iss
    time tto bbe happy. I’ve read tis post annd iif I cokuld I want too suggbest you few interesting
    things or tips. Maybe youu could write nwxt articles
    referring too this article. I want too rewad mre things aabout
    it!

  6. Hmmm itt seems likke your website atte mmy first
    comment (it waas super long) so I guees I’ll juzt sum it up whjat I had wriitten and say, I’m thoroughly enjoying your blog.
    I ttoo amm an aspiring blog wriyer buut I’m till nnew to everything.
    Do yyou have any points for newbie blogg writers? I’d reallly appreciate it.

  7. Simlly want too sayy yiur arfticle is as astonishing.
    Thee clearness in yourr pist iis simpky cool andd i can assuume
    you’re an expert onn thks subject. Fine with yoour permikssion allow mme to greab
    yoyr feerd to keep uup to date with forthcoming post.

    Thanks a million andd please carry on the rewrding work.

  8. Attractive componennt to content. I siply stumbbled uppon yokur sitfe annd inn accession caoital tto asert
    that I acquire actually enjoyed account your blog posts. Any waay I’ll bbe subscribingg to yojr augmnt
    andd evn I chievement you gget right of engry to consistently rapidly.

  9. I was recommended this web site by way of my
    cousin. I am not positive whether this put up is written via him as no one
    else recognize such detailed approximately my trouble. You’re incredible!
    Thanks!

  10. Wow that was unusual. I just wrote an very long comment but after I
    clicked submit my comment didn’t show up. Grrrr… well I’m not writing all that over again. Regardless, just wanted to say superb blog!

  11. Hello, I thinnk your websjte might bee havinng browser compatibility issues.
    Wheen I look at your blpog sjte in Chrome, it loks fijne but when opening inn Intwrnet Explorer,
    it hhas som overlapping. I justt wanted to givve you a quick
    heasds up! Other then that, excellent blog!

  12. Noormally I don’t lrarn post on blogs, howevr I wold like to saay that his write-up very comnpelled mee too check ouut annd ddo it!
    Yourr writing stylke has bee amazerd me. Than you,
    quite nice post.

  13. Howady I am so gld I found your site, I reslly found you
    bby mistake, while I was browsing onn Diggg for something else,
    Nonnetheless I amm heree noww and would juxt like too
    ssay thganks ffor a fantastic ppst and a all rond interestiing blog (I
    aalso love the theme/design), I don’t have tike tto go through itt alll at the minutee butt I have book-marked it and alo added in your RSS feeds, sso when I have time
    I willl bee back too read a loot more,Please do keep upp the superb jo.

  14. Grsat wblog rigght here! Alsoo yoiur web site loits uup fast!
    Whaat hodt aree youu the usafe of? Cann I get your associate liknk onn your host?

    I desire mmy web site loaded upp ass quickly aas yours lol

  15. My partner andd I sfumbled over here different web paqge aand thought I
    might as well chefk thhings out. I ike what I ssee so now i am
    following you. Look forwasrd too ooking into yor wweb paage for a seconnd time.

  16. Hello there! Quijck question that’s totally ooff
    topic. Do you know how tto make your ssite mobiule friendly?
    My weeb site looks wesird whenn browasing fdom my iphone4.
    I’m trying too find a theme or pllugin thuat mioght bee
    able too resolve this issue. If you have any recommendations, ppease share.
    Thank you!

  17. My spousee annd I stumbled oover here coming from a different wesite and thjought
    I may aas well cneck things out. I like what I see so noww i’m following you.
    Look forward too looking into your weeb page repeatedly.

  18. Thank you for your sharing. I am worried that I lack creative ideas. It is your article that makes me full of hope. Thank you. But, I have a question, can you help me?

  19. whoah this weblog is fantastic i really like studyikng your articles.
    Keeep uup the giod work! Yoou realize, a loot of ersons arre huntig rojnd
    ffor tthis information, youu cann help them greatly.

  20. An impressive share! I’ve jusst forwaarded this onto a co-worker who hass been conducting a little research
    on this. And he in fact ordered me lunch simlly becuse I founnd it for him…
    lol. So let mee rewodd this…. Thanmk YOU for thhe meal!!
    But yeah, thank for soending the time to discuss this mattter here on you blog.

Comments are closed.

Related Post