AWS Resource Management Using CloudShell

Mohamad MahmoodMohamad Mahmood
3 min read

step-by-step guide on using the AWS CLI to create, update, and delete AWS resources:

  1. Install and Configure the AWS CLI:

    • If you haven't installed the AWS CLI on your local machine, follow the official AWS CLI installation guide to install it: https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2.html

    • Once installed, configure the AWS CLI by running the aws configure command. Provide your AWS Access Key ID, Secret Access Key, default region, and output format when prompted.

  2. Open Amazon CloudShell:

    • Sign in to the AWS Management Console (https://console.aws.amazon.com/) using your AWS account credentials.

    • Search for "CloudShell" in the AWS Management Console search bar or navigate to the "Services" menu and select "CloudShell" under the "Developer Tools" category.

    • Click on the "Open CloudShell" button to launch CloudShell.

  3. Verify AWS CLI Configuration:

    • In the CloudShell terminal, run the command aws configure list. It will display the current AWS CLI configuration, including the configured AWS access key, secret access key, region, and output format. Verify that the configuration matches your expectations.
  4. Create AWS Resources:

    • To create an AWS resource, such as an Amazon S3 bucket, EC2 instance, RDS database, or DynamoDB table, you can use the relevant AWS CLI command.

    • Refer to the AWS CLI documentation (https://awscli.amazonaws.com/v2/documentation/api/latest/index.html) for the specific command and its required parameters.

    • For example, to create an S3 bucket, you can run the command aws s3api create-bucket --bucket <bucket-name> --region <region> and replace <bucket-name> with your desired bucket name and <region> with your desired AWS region.

  5. Update AWS Resources:

    • To update an existing AWS resource, use the appropriate AWS CLI command for that resource type.

    • Refer to the AWS CLI documentation for the specific command and its required parameters.

    • For example, to update an EC2 instance, you can run the command aws ec2 modify-instance-attribute --instance-id <instance-id> --attribute <attribute-name> --value <new-value> and replace <instance-id> with the ID of the instance you want to update, <attribute-name> with the name of the attribute you want to modify, and <new-value> with the desired new value.

  6. Delete AWS Resources:

    • To delete an AWS resource, use the relevant AWS CLI command for that resource type.

    • Be cautious when deleting resources, as this action is irreversible and can permanently remove data.

    • Refer to the AWS CLI documentation for the specific command and its required parameters.

    • For example, to delete an S3 bucket, you can run the command aws s3api delete-bucket --bucket <bucket-name> and replace <bucket-name> with the name of the bucket you want to delete.

Remember to consult the AWS CLI documentation for the specific commands and parameters related to the AWS resource you want to create, update, or delete. Ensure that you have the necessary permissions to perform these actions on your AWS account.

0
Subscribe to my newsletter

Read articles from Mohamad Mahmood directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Mohamad Mahmood
Mohamad Mahmood

Mohamad's interest is in Programming (Mobile, Web, Database and Machine Learning). He studies at the Center For Artificial Intelligence Technology (CAIT), Universiti Kebangsaan Malaysia (UKM).