[Reprint from ken's post]
1. AliCloud API overview
AliCloud API is a powerful abstraction of interacting the entire cloud infrastructure in a programmable fashion. 90% of the tasks that we can perform through the web console can also be achieved through API calls. This allows system administrators and developers to raise their productivity and embed automation in their day-to-day operation activities.
In order to connect to AliCloud API endpoints, we first need to obtain a pair of Access Key Secret, which is described next below.
2. Access Key Pair Generation
a. Login to the Web Console GUI:
- Click on the Console link on the top panel from the main website (www.alicloud.com)
- Login with your account username and password:
b. Once you are in the Web Console GUI, click on the ‘AccessKeys’ from the top panel
c. On the newly launched page, click “Create AccessKey” on the top right corner
d. Follow the prompted steps, including a step where you may have to click a link in the pop-out window to send a SMS to your registered mobile number with the confirmation 6-digit code.
e. After creation, we should see the key pair as below, with the Access Key Secret hidden
f. Click “Show” to obtain the key secret
g. Make a copy of the Access Key ID and Access Key Secret. We will need them in the next steps of setting up the environment. Please don’t share with anyone else as this would allow API calls across your cloud infrastructure (as we will see later).
3. Python SDK
AliCloud has integrated with various popular SDK: Java, Python, PHP, while many are being actively developed.
For this tutorial, we will use the Python SDK, and we are going to install the SDK for AliCloud OSS
a. Prerequisite: Python 2.7+
b. Install ‘pip’ for managing Python package dependencies management.
c. Use ‘pip’ to install the following AliCloud core packages:
>> pip install aliyun-python-sdk-core
>> pip install aliyun-python-sdk-oss
Please note that the above environment can be configured on ANY machines , it doesn’t have to be on any ECS instance running on the AliCloud.
4. Aliyuncli
Aliyuncli is built on top of the above core Python AliCloud packages, which provides a simple command line interface to interact with AliCloud infrastructure resources. Instead of writing your own programs from scratch, aliyuncli delivers a ready-to-use toolkit that wraps around most of the essential functions.
a. Use pip to install package ‘aliyuncli’
>> pip install aliyuncli
b. Configure ‘aliyuncli’ with the pair of Access Key obtained above by running the command, to setup the authentication parameters
>> aliyuncli oss Config --host oss.aliyuncs.com --accessid ***********Em --accesskey ***********0Dr
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。