An application programming interface (API) is the defined way software interacts with a service. In AWS, API requests let you use and control services without operating the hardware and software behind them. An application can call a NoSQL database or store files while AWS manages the underlying service. section 1.6 section 4.0
Choose how to make those requests:
- Use the Management Console for a web interface or the command-line interface (CLI) from a terminal. section 1.7
- Use an SDK to call the API from application code. It handles authentication, retries, HTTPS communication, and XML or JSON conversion. section 4.3
- Use CloudFormation templates to describe infrastructure; CloudFormation translates them into API calls. section 4.0
A web request that needs data
A user sends an HTTP request to a web application on a virtual machine. To answer it, the application can call AWS APIs to query a NoSQL database, store a static file, or send email. The user talks to the web application; the application talks to the services. section 1.6
Listing 12.5 nodetodo: Adding a user (index.js)
if (input['user-add'] === true) {
const params = {
Item: { #1
uid: {S: input['<uid>']}, #2
email: {S: input['<email>']}, #3
phone: {S: input['<phone>']} #4
},
TableName: 'todo-user', #5
ConditionExpression: 'attribute_not_exists(uid)' #6
};
db.putItem(params, (err) => { #7
if (err) {
console.error('error', err);
} else {
console.log('user added');
}
});
}
The DynamoDB user-add example shows a practical SDK call: assemble parameters, call putItem, then check for an error before reporting success. section 12.3.1
Calling the HTTP API directly requires repetitive work such as authentication and data conversion, so an SDK is usually simpler for application code. Every AWS API request is checked by Identity and Access Management (IAM); grant users and roles only the permissions they need. section 4.0 section 5.6











































