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/

 

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

  1. Профессиональный сервисный центр по ремонту техники в Йошкар-Оле.
    Мы предлагаем: Ремонт бесперебойников PowerWalker
    Наши мастера оперативно устранят неисправности вашего устройства в сервисе или с выездом на дом!

  2. Deze pagina is een online winkel voor voetbalshirts. Het focus ligt op de voetbalshirts van Albacete Balompie voor de seizoenen 2024 – 2025 en 2025 – 2026. Er zijn verschillende soorten shirts te koop, zoals thuis, uit en derde shirts, en zelfs een bijzondere versie. De prijzen liggen allemaal bij € 19,90. Daarnaast biedt de site voetbalshirts van vele andere teams, nationale teams en competities. Er is ook informatie over retourbeleid, verzending en meer.

  3. Cette page web est un véritable référence pour les passionnés de maillots de football. Elle offre une incroyable diversité de maillots, classés par sélections nationales, champions ligues et catégories spéciales comme les maillots rétro. Que tu sois admirateur de l’équipe de Toulouse, des grands clubs européens ou des équipes nationales, tu y trouveras sans doute le maillot qui te plaira. De plus, la page web permet de trier les produits par type, ce qui facilite la recherche.

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post