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. Heyy there! I knopw thius is ind off offf topic buut
    I wass wondering which blog patform are you using for this
    site? I’m geting sick and tired oof Wordoress because I’ve had issuees with hackoers and I’m lookig aat options foor another platform.

    I would bee fantastic iif youu could point mme in thhe direction oof a good platform.

  2. 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?

  3. I got thgis site frokm my ppal whho informed mme about this webb ppage
    and nnow tbis time I am visiting ths web page andd reading
    vrry informative posts here.

  4. Excellent pieces. Keep posting ssuch kinbd of ifo onn youyr site.

    Im really imprezsed by it.
    Heyy there, You’ve performed an incredible job.
    I’ll certainly digyg itt andd individuallpy recommend too mmy friends.
    I aam confidentt they’ll be benefited froom this website.

  5. I do not even knw how I endded up here, buut I thought this pot was good.
    I don’t knlw wwho you aree but defnitely yyou arre going to a famohs blgger
    if yoou aare nnot aleady ;) Cheers!

  6. Goood day! Do youu know if theey make aany
    pllugins tto prptect against hackers? I’m kinda pparanoid about llosing everything I’ve worked hrd on. Any recommendations?

  7. Askinng quetions aree reazlly fastidious thing if yyou are noot understanding anything totally, howevwr thos pwragraph proviides fastidious undsrstanding yet.

  8. Greetings! I knnow this is kinda ooff topic nevertheless I’d figured I’dask.
    Wouldd youu be interested inn tradijng links orr maybbe guest
    authoring a bllog article or vice-versa? My wehsite discusses a lot of
    thee same topics as yokurs aand I thinbk we cojld greatly bebefit from
    eeach other. If youu happen to bbe intetested feell frde tto send mme ann email.
    I look forwaard tto heearing from you! Fantasstic blog by thhe way!

  9. An intyeresting discussion is wworth comment. I thin that youu should publish more about tjis subject, it might nnot be a taboo subject but typcally folkks don’t talk
    aboout these issues. To the next! Cheers!!

  10. Hi there would yyou mind ltting mee kknow whih hosting company
    you’re using? I’ve looaded ylur blog in 3
    competely different browsers annd I must ssay this blog loads a lot
    faster then most. Caan yoou rcommend a goood hosting pfovider aat a reasonable price?
    Thanks, I appreciazte it!

  11. Yoou can certainly see yojr expertise iin the work youu
    write. Thee sector hopes for more passionate writers such ass you who arre nott afrtaid to saay hoow thewy believe.

    All tthe time follow yiur heart.

  12. Do youu ind iif I qhote a ffew of your article
    as lkng as I provide crediit and sourcs back to your weblog?
    My blog site iis in thee exact same niche as yours and myy users wuld genuiinely benewfit from a llot of the informatfion you
    present here. Plese let me know if thjs olay witth you. Regards!

  13. Hi there, i read your blogg from time to time andd i own a similar onne andd i
    wwas just wondering if you get a lot oof spam responses?
    If so hhow ddo you potect agqinst it, anny plugin or anythig you ccan recommend?
    I geet so mufh lately it’s riving me mad soo anyy hellp is vey much appreciated.

  14. Hey There. I found your bblog the usage of msn. That
    is a very smartlyy written article. I will be sue to bookmark
    it and come back too learn moore off your useeful info.

    Thannk youu ffor thhe post. I wll certainly comeback.

  15. Great post hoiwever I was wondering if yyou could
    writye a littye more on this subject? I’d bee verey grateful if yyou could elaborate a litttle bitt further.
    Many thanks!

  16. I hafe beedn bropwsing online more than three hiurs today, yet I neer found any interesting artgicle like yours.
    It’s prettty worth enough for me. Personally, iif alll webmasters and bpoggers
    madde gookd contnt as you did, the webb will be much more
    usefjl than ever before.

  17. Aftfer I originally left a comment I seem to have clicked onn the -Notify me when new comments are added- cheeckbox and noow eeach time a comment iis asded
    I gett 4 eemails wijth thee same comment. Is thjere a wayy yyou aare agle tto remove me from tthat service?
    Cheers!

  18. Afer I originaly commented I apppear to ave clicdked thhe -Notigy mee when neew commets aare added- checkbox andd from noow onn
    eac tie a comment iis added I receige our emmails wiyh the same comment.
    There has to bbe an easy methodd you can remoce mee from thast
    service? Thanks!

Comments are closed.

Related Post