Название: AWS Certified SysOps Administrator Official Study Guide
Автор: Cole Stephen
Издательство: Автор
Жанр: Зарубежная образовательная литература
isbn: 9781119377436
isbn:
If you want to use Boto in your Python code, you start by importing the Boto SDK:
import boto3
And, if you’re using Interactive mode, you then press Enter.
To start using the Boto class in Python, invoke it by calling boto3.resource and passing in a service name in single quotes. For example, if you wanted to perform an action using Amazon EC2, you would execute something similar to the following:
ec2 = boto3.resource('ec2')
You now have an object called ec2, which you can use to act on Amazon EC2 instances in your AWS account. You can then instantiate a method object pointing to a specific instance in your Amazon Virtual Private Cloud (Amazon VPC):
myinstance = ec2.Instance('i-0bxxxxxxxxxxxxxxx')
Perhaps you want to stop an Amazon EC2 instance programmatically, possibly at the end of a shift to save money when it’s not being used. You can then issue a command to stop that instance:
myinstance.stop()
You can start the instance back up again automatically prior to the beginning of the next shift:
myinstance.start()
Acting on infrastructure resources isn’t your only option with Boto. You can also retrieve information from the APIs about your resources. For example, perhaps you want to find out what AMI is being used for the instance in question. You can do that by passing the following command:
instance.image_id
A string is returned for this command containing the AMI ID of the named instance.
We’ve been covering the language-specific AWS SDKs, which focus on the management of many AWS Cloud services. There are two purpose-specific SDKs as well: The AWS IoT Device SDK and the AWS Mobile SDK. Like the general-usage SDKs that we covered previously, these purpose-specific SDKs also provide developers with the ability to use prebuilt libraries that make it easier for them to focus on innovation in their code, not in how they connect to the infrastructure that runs it.
The IoT and Mobile SDKs are different because they are purpose-built to streamline connecting physical devices, like phones and tablets or sensors and hubs, to the cloud. The SDKs are provided for a variety of languages commonly used on their respective platforms. At the time this book was written, these SDKs were available for the following languages/platforms:
AWS Mobile SDK
■ Android
■ iOS
■ Unity
■ .NET
■ Xamarin
■ React Native
AWS IoT Device SDK
■ Embedded C
■ JavaScript
■ Arduino Yún
■ Java
■ Python
■ iOS
■ Android
■ C++
Like the SDKs previously discussed, many of these SDKs provide their source code in GitHub. Each contains extensive documentation and helpful sample code to allow developers to get up and running quickly.
Summary
As a highly-qualified AWS systems operator, you should have a strong understanding of the use of the AWS CLI. It makes your job easier and helps you automate much of the undifferentiated heavy lifting that performing cloud tasks manually would entail. Knowing how to use these AWS tools makes gaining experience to become a qualified candidate for the AWS Certified SysOps Administrator – Associate exam that much easier.
Additionally, you should have enough of an understanding of the AWS SDKs that you can help your development colleagues understand their business value and use your knowledge to help them troubleshoot as connectivity or infrastructure issues arise.
Exam Essentials
Know the basic ways to interact with AWS. AWS Management Console, AWS Software Development Kits, and the AWS Command Line Interface (AWS CLI). On the exam, you will not be asked any code, or commands. However, you must understand there is more than one way to administer your AWS resources.
Understand Access Keys. As the Systems Operator, understand that access keys are not generated when you create an IAM account. For more information on access keys, refer to Chapter 3, “Security and AWS Identity and Access Management (IAM).”
Resources to Review
For assistance in completing the exercises that follow, we recommend these resources:
The AWS CLI User Guide at:http://docs.aws.amazon.com/cli/latest/userguide
AWS Command Line Interface on Microsoft Windows:http://docs.aws.amazon.com/cli/latest/userguide/awscli-install-windows.html
AWS Tools for PowerShell:https://aws.amazon.com/powershell/
JMESPath query language:http://jmespath.org/tutorial.html
BOTO General Feature Guides:https://boto3.readthedocs.io/en/latest/guide/index.html#general-feature-guides
Exercises
Throughout this book, you will be using the AWS CLI. These exercises serve as the instructions to install the CLI on Linux, Mac, and Windows.
By now you have set up an account in AWS. If you haven’t already, now would be the time to do so. It is important to note that these exercises are in your AWS account and thus are not free.
Use the Free Tier when launching resources. The AWS Free Tier applies to participating services across the following AWS regions: US East (Northern Virginia), US West (Oregon), US West (Northern California), Canada (Central), EU (London), EU (Ireland), EU (Frankfurt), Asia Pacific (Singapore), Asia Pacific (Tokyo), Asia Pacific (Sydney), and South America (Sao Paulo). For more information, see https://aws.amazon.com/s/dm/optimization/server-side-test/free-tier/free_np/.
СКАЧАТЬ