Tools for managing AWS cloud services

The Right Button

Configuring Your Credentials

To configure your credentials, you need the

aws configure

command. You are prompted for the AWS Access Key ID, the AWS Secret Access Key, the default region name, and the default output format. You can use the credentials of an existing user in AWS IAM or create a new one.

To override the default region, you stipulate the --region option with each command (e.g., --region eu-central-1). For a list of region codes, see the Regions menu in the AWS Management Console. Finally, the format type specifies how the output will be displayed by default; the options include JavaScript Object Notation (JSON), YAML, and TEXT. After entering all the data, you should see output like this in the terminal:

AWS Access Key ID [None]: ABCDEFGHIJKLM
AWS Secret Access Key [None]: ABCDEFGHIJKLM
Default region name [None]: eu-central-1
Default output format [None]: json

Now run the command mentioned earlier,

aws ec2 describe-vpcs

and you now see output because each new AWS account comes with a default network – Amazon Virtual Private Cloud (VPC) – preconfigured,

{
   "vpcs": [
     {
       "CidrBlock": "10.0.0/16",
       "DhcpOptionsId": "dopt-d12345",
       }, "state": "available",
       "VpcId": "vpc-0123456789abc def",
       }, "ownerId": "123456789012",
       ....

which confirms that your AWS CLI is set up correctly. Two new files (config and credentials) have been created, either in ~/.aws (Linux/macOS) or in %UserProfile%\.aws (Windows). The credentials file contains the credentials you specified.

Managing S3 with the Python SDK

APIs let you completely manage AWS services. The cloud provider offers SDKs to reduce programming complexity. A wide range of programming languages and frameworks are supported:

  • In general: C++, JavaScript, Python, PHP, .NET, Rust, Swift, Kotlin, Ruby, Java, Go, and Node.js
  • Hardware-related programming languages: Embedded C and Arduino
  • Web: React, Angular, Vue, and Next.js
  • Mobile: Android, iOS, React Native, Ionic, and Flutter

For example, the AWS SDK for Python, Boto3 – named after the Amazon River freshwater dolphin – requires at least Python 3.6. Later, I will go through the steps to list all the Amazon Simple Storage Service (S3) buckets (containers for data stored in Amazon S3).

To begin, install the latest Boto3 version by typing:

pip install boto3

Make sure you have valid AWS credentials. To do so, configure your Access Key and Secret Access Key with aws configure, as described earlier. After you import Boto3 and specify which service you want to use, you are ready to use it. In this example, I work with the Python interactive shell and Amazon S3 object storage:

import boto3
s3 = boto3.resource('s3')

You now have an S3 resource, so you can send requests to the service. The code

for bucket in s3.buckets.all():
    print(bucket.name)

uses the S3 bucket API to output all the bucket names.

Toolkit for JetBrains

The majority of developers and administrators use an IDE to help uniformly develop, test, debug, and deploy software and infrastructure. Existing IDEs can be extended with AWS toolkits to interact smoothly with the AWS cloud. Supported IDEs include:

  • Eclipse
  • AWS Cloud9
  • Microsoft: Visual Studio, Visual Studio Code, and Azure DevOps
  • JetBrains: CLion, GoLand, IntelliJ, WebStorm, Rider, PhpStorm, PyCharm, RubyMine, and DataGrip

By way of an example, I look at JetBrains. As a prerequisite, you first need to install and launch a supported JetBrains IDE. Next, open the Preferences, select Plugins and click the Marketplace tab. In the search box, enter AWS Toolkit . When AWS Toolkit by Amazon Web Services appears, select it, install the plugin, and restart the IDE. To connect to an AWS account for the first time, select AWS: No credentials selected in the status bar (Figure 4).

Figure 4: Before using the AWS toolkit for JetBrains for the first time, a click on the status bar is required to connect to an AWS account.

Now, either choose an AWS profile configured in the previous two sections or edit the AWS credentials in Edit AWS Credential file(s) . To test the configuration, select the CloudWatch Logs node to see the list of log groups. Double-click on the name of a log group and select a log stream to read the specific log messages.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy ADMIN Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

comments powered by Disqus
Subscribe to our ADMIN Newsletters
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs



Support Our Work

ADMIN content is made possible with support from readers like you. Please consider contributing when you've found an article to be beneficial.

Learn More”>
	</a>

<hr>		    
			</div>
		    		</div>

		<div class=