Wednesday, 26 February 2020
Introduction To Serverless
Monday, 24 February 2020
Introduction To Artificial Intelligence
Introduction To Machine Learning Using Python
What is the Machine Learning?
Machine learning is the scientific study of algorithms and statistical models that computer systems use to perform a specific task without using explicit instructions, relying on patterns and inference instead. It is seen as a subset of artificial intelligence (AI).
Machine learning is the scientific study of algorithms and statistical models that computer systems use to perform a specific task without using explicit instructions, relying on patterns and inference instead. It is seen as a subset of artificial intelligence (AI).
Introduction To Docker
What is a Docker?
Docker is a open source tool to make easier to create, deploy, and run application by using containers. Container allow a developer to package up an application with all of the parts it needs, such as libraries and other dependencies, and deploy it as one package.Using Amazon SQS with the AWS CLI - Part 9
You can access the features of Amazon Simple Queue Service (Amazon SQS) using the AWS Command Line Interface (AWS CLI).
Before you run any commands, set your default credentials. For more information, see Configuring the AWS CLI.
Before you run any commands, set your default credentials. For more information, see Configuring the AWS CLI.
Create Queue
Creates a new standard or FIFO queue. You can pass one or more attributes in the request. Keep the following caveats in mind:
- If you don't specify the FifoQueue attribute, Amazon SQS creates a standard queue.
- If you don't provide a value for an attribute, the queue is created with the default value for the attribute.
- If you delete a queue, you must wait at least 60 seconds before creating a queue with the same name.
create-queue
--queue-name <value>
[--attributes <value>]
[--tags <value>]
[--cli-input-json <value>]
$ aws sqs create-queue --queue-name test-queue
{
"QueueUrl": "https://ap-south-1.queue.amazonaws.com/23456789012/test-queue"
}
Delete Queue
Deletes the specified message from the specified queue. To select the message to delete, use the ReceiptHandle of the message (not the MessageId which you receive when you send the message). Amazon SQS can delete a message from a queue even if a visibility timeout setting causes the message to be locked by another consumer. Amazon SQS automatically deletes messages left in a queue longer than the retention period configured for the queue. delete-message
--queue-url <value>
--receipt-handle <value>
[--cli-input-json <value>]
[--generate-cli-skeleton <value>]
Sunday, 23 February 2020
Using Amazon S3 with the AWS CLI - Part 8
You can access the features of Amazon Simple Storage Service (Amazon S3) using the AWS Command Line Interface (AWS CLI).
High-level
Before you run any commands, set your default credentials. For more information, see Configuring the AWS CLI.
The AWS CLI provides two tiers of commands for accessing Amazon S3:
- The s3 tier consists of high-level commands that simplify performing common tasks, such as creating, manipulating, and deleting objects and buckets.
- The s3api tier behaves identically to other AWS services by exposing direct access to all Amazon S3 API operations. It enables you to carry out advanced operations that might not be possible with the following tier's high-level commands alone.
To get a list of all of the commands available in each tier, use the help argument with the aws s3api or aws s3 commands.
$
aws s3 help
$
aws s3api help
Using High-Level (s3) Commands with the AWS CLI
This topic describes how you can manage Amazon S3 buckets and objects using high-level aws s3 commands.
Before you run any commands, set your default credentials. For more information, see Configuring the AWS CLI.
Manage Buckets
High-level aws s3
commands support common bucket operations, such as creating, listing, and deleting buckets.
Create a Bucket
Use the s3 mb command to create a bucket. Bucket names must be globally unique and should be DNS compliant. Bucket names can contain lowercase letters, numbers, hyphens, and periods. Bucket names can start and end only with a letter or number, and cannot contain a period next to a hyphen or another period.
$
aws s3 mb s3://bucket-name
Using Amazon SNS with the AWS CLI - Part 7
You can access the features of Amazon Simple Notification Service (Amazon SNS) using the AWS Command Line Interface (AWS CLI). To list the AWS CLI commands for Amazon SNS, use the following command.
$ aws sns help
Before you run any commands, set your default credentials. For more information, see Configuring the AWS CLI.
Topics
Create a Topic
To create a topic, use the
create-topic
command and specify the name to assign to the topic.$ aws sns create-topic --name my-topic
{
"TopicArn": "arn:aws:sns:ap-south-1:123456789012:my-topic"
}
Make a note of the response's
TopicArn
, which you use later to publish a message.Subscribe to a Topic
To subscribe to a topic, use the
subscribe
command.
The following example specifies the
email
protocol and an email address for the notification-endpoint
.$
aws sns subscribe --topic-arn arn:aws:sns:us-west-2:123456789012:my-topic
--protocol email
--notification-endpoint sujeet@example.com
{
"SubscriptionArn": "pending confirmation"
}
AWS immediately sends a confirmation message by email to the address you specified in the
subscribe
command. The email message has the following text.You have chosen to subscribe to the topic:
arn:aws:sns:us-west-2:123456789012:my-topic
To confirm this subscription, click or visit the following link (If this was in error no action is necessary):
Confirm subscription
After the recipient clicks the Confirm subscription link, the recipient's browser displays a notification message with information similar to the following.
Subscription confirmed!
You have subscribed saanvi@example.com to the topic:my-topic.
Your subscription's id is:
arn:aws:sns:us-west-2:123456789012:my-topic:1328f057-de93-4c15-512e-8bb22EXAMPLE
If it was not your intention to subscribe, click here to unsubscribe.
Publish to a Topic
To send a message to all subscribers of a topic, use the publish command.
The following example sends the message "Hello World!" to all subscribers of the specified topic.
$ aws sns publish --topic-arn arn:aws:sns:ap-south-1:123456789012:my-topic --message "Hello World!"{
"MessageId": "08ac5412-d867-5372-85f3-02de50785f63"
}
In this example, AWS sends an email message with the text "Hello World!" to
saanvi@example.com
.Unsubscribe from a Topic
To unsubscribe from a topic and stop receiving messages published to that topic, use the unsubscribe command and specify the ARN of the topic you want to unsubscribe from.
$
aws sns unsubscribe --subscription-arn
arn:aws:sns:us-west-2:123456789012:my-topic:1328f057-de93-4c15-512e-8bb22EXAMPLE
To verify that you successfully unsubscribed, use the list-subscriptions command to confirm that the ARN no longer appears in the list.
$ aws sns list-subscriptions
{
"Subscriptions": [
{
"SubscriptionArn": "arn:aws:sns:ap-south-1:123456789012:sns-t-sqs:a3f3e8b5-d82c-44f1-8321-d671e1d00058",
"Owner": "123456789012",
"Protocol": "sqs",
"Endpoint": "arn:aws:sqs:ap-south-1:123456789012:sqs-t-sns",
"TopicArn": "arn:aws:sns:ap-south-1:123456789012:sns-t-sqs"
}
]
}
Delete a Topic
To delete a topic, run the delete-topic command.
$ aws sns delete-topic --topic-arn arn:aws:sns:us-west-2:123456789012:my-topic
To verify that AWS successfully deleted the topic, use the list-topics command to confirm that the topic no longer appears in the list.
$ aws sns list-topics
{
"Topics": [
{
"TopicArn": "arn:aws:sns:ap-south-1:123456789012:dynamodb"
},
{
"TopicArn": "arn:aws:sns:ap-south-1:123456789012:my-topic"
}
]
}
Amazon Elastic Container Service (ECS) - Part 2
Using Amazon DynamoDB with the AWS CLI - Part 6
To list the AWS CLI commands for DynamoDB, use the following command.
$
aws dynamodb help
Before you run any commands, set your default credentials. For more information, see Configuring the AWS CLI.
For example, the following command creates a table named MusicCollection.
$
aws dynamodb create-table \
--table-name MusicCollection \
--attribute-definitions AttributeName=Artist,AttributeType=S AttributeName=SongTitle,AttributeType=S \
--key-schema AttributeName=Artist,KeyType=HASH AttributeName=SongTitle,KeyType=RANGE \
--provisioned-throughput ReadCapacityUnits=1,WriteCapacityUnits=1
{
"TableDescription": {
"AttributeDefinitions": [
{
"AttributeName": "Artist",
"AttributeType": "S"
},
{
"AttributeName": "SongTitle",
"AttributeType": "S"
}
],
"TableName": "MusicCollection",
"KeySchema": [
{
"AttributeName": "Artist",
"KeyType": "HASH"
},
{
"AttributeName": "SongTitle",
"KeyType": "RANGE"
}
],
"TableStatus": "CREATING",
"CreationDateTime": 1582461871.325,
"ProvisionedThroughput": {
"NumberOfDecreasesToday": 0,
"ReadCapacityUnits": 1,
"WriteCapacityUnits": 1
},
"TableSizeBytes": 0,
"ItemCount": 0,
"TableArn": "arn:aws:dynamodb:ap-south-1:809160705184:table/MusicCollection",
"TableId": "00c2767a-1337-4f6d-ae81-87792185da75"
}
}
"TableDescription": {
"AttributeDefinitions": [
{
"AttributeName": "Artist",
"AttributeType": "S"
},
{
"AttributeName": "SongTitle",
"AttributeType": "S"
}
],
"TableName": "MusicCollection",
"KeySchema": [
{
"AttributeName": "Artist",
"KeyType": "HASH"
},
{
"AttributeName": "SongTitle",
"KeyType": "RANGE"
}
],
"TableStatus": "CREATING",
"CreationDateTime": 1582461871.325,
"ProvisionedThroughput": {
"NumberOfDecreasesToday": 0,
"ReadCapacityUnits": 1,
"WriteCapacityUnits": 1
},
"TableSizeBytes": 0,
"ItemCount": 0,
"TableArn": "arn:aws:dynamodb:ap-south-1:809160705184:table/MusicCollection",
"TableId": "00c2767a-1337-4f6d-ae81-87792185da75"
}
}
You can add new lines to the table with commands similar to those shown in the following example. These examples use a combination of shorthand syntax and JSON.
$
aws dynamodb put-item \
--table-name MusicCollection \
--item '{
"Artist": {"S": "No One You Know"},
"SongTitle": {"S": "Call Me Today"} ,
"AlbumTitle": {"S": "Somewhat Famous"}
}' \
--return-consumed-capacity TOTAL
{
"ConsumedCapacity": {
"CapacityUnits": 1.0,
"TableName": "MusicCollection"
}
}
$
aws dynamodb put-item \
--table-name MusicCollection \
--item '{
"Artist": {"S": "Acme Band"},
"SongTitle": {"S": "Happy Day"} ,
"AlbumTitle": {"S": "Songs About Life"}
}' \
--return-consumed-capacity TOTAL
{
"ConsumedCapacity": {
"CapacityUnits": 1.0,
"TableName": "MusicCollection"
}
}
You can use that file to issue a query request using the AWS CLI.
$
aws dynamodb query --table-name MusicCollection \
--key-condition-expression "Artist = :v1 AND SongTitle = :v2" \
--expression-attribute-values file://expression-attributes.json
{
"Count": 1,
"Items": [
{
"AlbumTitle": {
"S": "Somewhat Famous"
},
"SongTitle": {
"S": "Call Me Today"
},
"Artist": {
"S": "No One You Know"
}
}
],
"ScannedCount": 1,
"ConsumedCapacity": null
}
$ aws dynamodb delete-table --table-name MusicCollection
"Count": 1,
"Items": [
{
"AlbumTitle": {
"S": "Somewhat Famous"
},
"SongTitle": {
"S": "Call Me Today"
},
"Artist": {
"S": "No One You Know"
}
}
],
"ScannedCount": 1,
"ConsumedCapacity": null
}
For example, the following command delete a table named MusicCollection.
$ aws dynamodb delete-table --table-name MusicCollection
{
"TableDescription": {
"TableName": "MusicCollection",
"TableStatus": "DELETING",
"ProvisionedThroughput": {
"NumberOfDecreasesToday": 0,
"ReadCapacityUnits": 1,
"WriteCapacityUnits": 1
},
"TableSizeBytes": 0,
"ItemCount": 0,
"TableArn": "arn:aws:dynamodb:ap-south-1:809160705184:table/MusicCollection",
"TableId": "00c2767a-1337-4f6d-ae81-87792185da75"
}
}
For example, the following command list a table named.
$ aws dynamodb list-tables
{
"TableNames": [
"MusicsCollection",
"VideosCollection",
"SongsCollection",
"DocumentCollection"
]
}
Saturday, 22 February 2020
Using The AWS Command Line Interface (AWS CLI) - Part 5
Command Structure in the AWS CLI
Getting Help with the AWS CLI
You can get help with any command when using the AWS Command Line Interface (AWS CLI). To do so, simply type
For example, the following command displays help for the general AWS CLI options and the available top-level commands.
The AWS Command Line Interface (AWS CLI) uses a multipart structure on the command line that must be specified in this order:
- The base call to the aws program.
- The top-level command, which typically corresponds to an AWS service supported by the AWS CLI. Like - sns, sqs etc.
- The subcommand that specifies which operation to perform.
- General CLI options or parameters required by the operation. You can specify these in any order as long as they follow the first three parts. If an exclusive parameter is specified multiple times, only the last value applies.
$
aws <command
> <subcommand
> [options and parameters
]
Parameters can take various types of input values, such as numbers, strings, lists, maps, and JSON structures. What is supported is dependent upon the command and subcommand you specify.
You can get help with any command when using the AWS Command Line Interface (AWS CLI). To do so, simply type
help
at the end of a command name.For example, the following command displays help for the general AWS CLI options and the available top-level commands.
$
aws help
The following command displays the available Amazon Elastic Compute Cloud (Amazon EC2) specific commands.
$
aws ec2 help
Configuration The AWS Command Line Interface (AWS CLI) - Part 4
Installing The AWS Command Line Interface (AWS CLI) - Part 3
AWS CLI version 1
AWS CLI version 1 is the original AWS CLI, and we continue to support it. However, major new features that are introduced in AWS CLI version 2 might not be backported to AWS CLI version 1. To use those features, you must install AWS CLI version 2.
Migrating from AWS CLI version 1 to version 2
If you ran commands or scripts with AWS CLI version 1 and you are considering migrating to AWS CLI version 2, see Breaking Changes – Migrating from AWS CLI version 1 to version 2 for a description of the changes that you should know about.
AWS CLI version 1 is the original AWS CLI, and we continue to support it. However, major new features that are introduced in AWS CLI version 2 might not be backported to AWS CLI version 1. To use those features, you must install AWS CLI version 2.
Migrating from AWS CLI version 1 to version 2
If you ran commands or scripts with AWS CLI version 1 and you are considering migrating to AWS CLI version 2, see Breaking Changes – Migrating from AWS CLI version 1 to version 2 for a description of the changes that you should know about.
Installing The AWS Command Line Interface (AWS CLI) - Part 2
The AWS Command Line Interface is available in two versions.
AWS CLI version 2
AWS CLI version 2 is the most recent major version of the AWS CLI and supports all of the latest features. Some features introduced in version 2 are not backward compatible with version 1 and you must upgrade to access those features. AWS CLI version 2 is available to install only as a bundled installer. Although you might find it in some package managers, these are not produced or managed by AWS and are therefore not official and not supported by AWS. We recommend that you install the AWS CLI from only the official AWS distribution points, as documented in this guide.
Installing AWS CLI version 2 on Windows
This section describes how to install, upgrade, and remove AWS CLI version 2 on Windows.
Topics
Prerequisites for Windows
The AWS CLI version 2 is supported on Windows XP or later. The AWS CLI version 2 supports only 64-bit versions of Windows.
Installing on Windows
For Windows users, the MSI installation package offers a familiar and convenient way to install the AWS CLI version 2 without installing any other prerequisites.
C:\> aws --version
aws-cli/2.0.0 Python/3.7.4 Windows/10 botocore/2.0.0
Don't include the prompt symbol (C:\>, shown above) when you type a command. These are included in program listings to differentiate commands that you type from output returned by the AWS CLI. The rest of this guide uses the generic prompt symbol, $ , except in cases where a command is Windows-specific.
If Windows is unable to find the program, you might need to close and reopen the command prompt to refresh the path, or add the installation directory to your PATH environment variable manually.
Upgrading on Windows
Removing from Windows
To uninstall the AWS CLI, open the Control Panel, and then choose Programs and Features. Select the entry named AWS Command Line Interface, and then choose Uninstall to launch the uninstaller. Confirm that you want to uninstall the AWS CLI when you're prompted. You can also launch the Programs and Features program from the command line with the following command.
AWS CLI version 2 is the most recent major version of the AWS CLI and supports all of the latest features. Some features introduced in version 2 are not backward compatible with version 1 and you must upgrade to access those features. AWS CLI version 2 is available to install only as a bundled installer. Although you might find it in some package managers, these are not produced or managed by AWS and are therefore not official and not supported by AWS. We recommend that you install the AWS CLI from only the official AWS distribution points, as documented in this guide.
Installing AWS CLI version 2 on Windows
This section describes how to install, upgrade, and remove AWS CLI version 2 on Windows.
Topics
Prerequisites for Windows
The AWS CLI version 2 is supported on Windows XP or later. The AWS CLI version 2 supports only 64-bit versions of Windows.
Installing on Windows
For Windows users, the MSI installation package offers a familiar and convenient way to install the AWS CLI version 2 without installing any other prerequisites.
- To install the AWS CLI version 2 using the MSI installer Download the AWS CLI MSI installer for Windows (64-bit) at https://awscli.amazonaws.com/AWSCLIV2.msi
- Run the downloaded MSI installer and follow the onscreen instructions. By default, the AWS CLI installs to C:\Program Files\Amazon\AWSCLIV2.
- To confirm the installation, use the aws --version command at a command prompt (open the Start menu and search for cmd to start a command prompt).
C:\> aws --version
aws-cli/2.0.0 Python/3.7.4 Windows/10 botocore/2.0.0
Don't include the prompt symbol (C:\>, shown above) when you type a command. These are included in program listings to differentiate commands that you type from output returned by the AWS CLI. The rest of this guide uses the generic prompt symbol, $ , except in cases where a command is Windows-specific.
If Windows is unable to find the program, you might need to close and reopen the command prompt to refresh the path, or add the installation directory to your PATH environment variable manually.
Upgrading on Windows
- AWS CLI is updated regularly. Check the Releases page on GitHub to see when the latest version was released.
- To update to the latest version, download the latest version of the MSI installer and run it, as described previously. It automatically overwrites the previous version.
Removing from Windows
To uninstall the AWS CLI, open the Control Panel, and then choose Programs and Features. Select the entry named AWS Command Line Interface, and then choose Uninstall to launch the uninstaller. Confirm that you want to uninstall the AWS CLI when you're prompted. You can also launch the Programs and Features program from the command line with the following command.
C:\>
appwiz.cpl
AWS Command Line Interface (AWS CLI) - Part 1
The AWS Command Line Interface (AWS CLI) is an open source tool that enables you to interact with AWS services using commands in your command-line shell.
The AWS CLI is available in two versions:
The AWS CLI is available in two versions:
- Version 2.x – The current, generally available release of the AWS CLI. This version does include some "breaking" changes from version 1 that might require you to change your scripts so that they continue to operate as you expect. For a list of new features and breaking changes in version 2, see Breaking Changes – Migrating from AWS CLI version 1 to version 2.
- Version 1.x – The previous version of the AWS CLI that is available for backwards compatiblity.
The command prompt in your favorite terminal program:
Linux shells - Use common shell programs such as bash, zsh, and tcsh to run commands in Linux or macOS.
Windows command line - On Windows, run commands at the Windows command prompt or in PowerShell.
Remotely - Run commands on Amazon Elastic Compute Cloud (Amazon EC2) instances through a remote terminal program such as PuTTY or SSH, or with AWS Systems Manager.
The AWS CLI provides direct access to the public APIs of AWS services. You can explore a service's capabilities with the AWS CLI, and develop shell scripts to manage your resources. Or, you can take what you learn to develop programs in other languages by using the AWS SDKs.
In addition to the low-level, API-equivalent commands, several AWS services provide customizations for the AWS CLI. Customizations can include higher-level commands that simplify using a service with a complex API. For example, the aws s3 commands provide a familiar syntax for managing files in Amazon Simple Storage Service (Amazon S3).
AWS CLI version 2
AWS CLI version 2 is the most recent major version of the AWS CLI and supports all of the latest features. Some features introduced in version 2 are not backward compatible with version 1 and you must upgrade to access those features. AWS CLI version 2 is available to install only as a bundled installer. Although you might find it in some package managers, these are not produced or managed by AWS and are therefore not official and not supported by AWS. We recommend that you install the AWS CLI from only the official AWS distribution points, as documented in this guide.
AWS CLI version 1
AWS CLI version 1 is the original AWS CLI, and we continue to support it. However, major new features that are introduced in AWS CLI version 2 might not be backported to AWS CLI version 1. To use those features, you must install AWS CLI version 2.
Migrating from AWS CLI version 1 to version 2
If you ran commands or scripts with AWS CLI version 1 and you are considering migrating to AWS CLI version 2, see Breaking Changes – Migrating from AWS CLI version 1 to version 2 for a description of the changes that you should know about.
AWS CLI version 2
AWS CLI version 2 is the most recent major version of the AWS CLI and supports all of the latest features. Some features introduced in version 2 are not backward compatible with version 1 and you must upgrade to access those features. AWS CLI version 2 is available to install only as a bundled installer. Although you might find it in some package managers, these are not produced or managed by AWS and are therefore not official and not supported by AWS. We recommend that you install the AWS CLI from only the official AWS distribution points, as documented in this guide.
AWS CLI version 1
AWS CLI version 1 is the original AWS CLI, and we continue to support it. However, major new features that are introduced in AWS CLI version 2 might not be backported to AWS CLI version 1. To use those features, you must install AWS CLI version 2.
Migrating from AWS CLI version 1 to version 2
If you ran commands or scripts with AWS CLI version 1 and you are considering migrating to AWS CLI version 2, see Breaking Changes – Migrating from AWS CLI version 1 to version 2 for a description of the changes that you should know about.
Amazon Elastic Container Service (ECS) - Part 1
Amazon Elastic Container Service (Amazon ECS) is a highly scalable, fast, container management service that easy to run, stop, and manage Docker container on a cluster. You can host your cluster on a serverless infrastructure that is managed by Amazon ECS by launching your services or task using the Fargate launch type. For more control you can host your tasks on a cluster of Amazon Elastic Compute Cloud (Amazon ECS) instances that you manage by using the EC2 lunch type. For more information about launch type, see Amazon ECS Launch Types.
You can use Amazon ECS to schedule the placement of container across your cluster based on your resources needs, isolation policies, and availability requirements. Amazon ECS eliminates the need for you to operate your own cluster management and configuration management systems or worry about scaling your management infrastructure.
Features of Amazon ECS
Amazon ECS is a regional service that simplifies running application containers in a highly available manner across multilpe Availability Zones (AZ) withing a Resion. You can create the Amazon ECS clusters within a new or existing VPC. After a cluster is up and running , you can define task definations and services that specify which Docker container images to run across your clusters. Container images are stored in and pulled from container registries, which my exist within or outside of your AWS infrastructure.
Container and Images
To deploy applications on Amazon ECS, your application components must be architected to run in containers. A Docker container is a standardized unit of software development, containing everything that your software application needs to run: code, runtime, system tools, system libraries, etc. Containers are created from a read-only template called an image.
Images are typically built from a Dockerfile, a plain text file that specifies all of the components that are included in the container. These images are then stored in a registry from which they can be downloaded and run on your cluster.
Task Definitions
To prepare your application to run on Amazon ECS, you create a task definition. The task definition is a text file, in JSON format, that describes one or more containers, up to a maximum of ten, that form your application. It can be thought of as a blueprint for your application. Task definitions specify various parameters for your application. Examples of task definition parameters are which containers to use, which launch type to use, which ports should be opened for your application, and what data volumes should be used with the containers in the task. The specific parameters available for the task definition depend on which launch type you are using. For more information about creating task definitions, see Amazon ECS Task Definitions.
{
"family": "webserver",
"containerDefinitions": [
{
"name": "web",
"image": "nginx",
"memory": "100",
"cpu": "99"
},
],
"requiresCompatibilities": [
"FARGATE"
],
"networkMode": "awsvpc",
"memory": "512",
"cpu": "256",
}
Tasks and Scheduling
A task is the instantiation of a task definition within a cluster. After you have created a task definition for your application within Amazon ECS, you can specify the number of tasks that will run on your cluster. Each task that uses the Fargate launch type has its own isolation boundary and does not share the underlying kernel, CPU resources, memory resources, or elastic network interface with another task. The Amazon ECS task scheduler is responsible for placing tasks within your cluster. There are several different scheduling options available. For example, you can define a service that runs and maintains a specified number of tasks simultaneously.
Clusters
When you run tasks using Amazon ECS, you place them on a cluster, which is a logical grouping of resources. When using the Fargate launch type with tasks within your cluster, Amazon ECS manages your cluster resources. When using the EC2 launch type, then your clusters are a group of container instances you manage. An Amazon ECS container instance is an Amazon EC2 instance that is running the Amazon ECS container agent. Amazon ECS downloads your container images from a registry that you specify, and runs those images within your cluster.
Container Agent
The container agent runs on each infrastructure resource within an Amazon ECS cluster. It sends information about the resource's current running tasks and resource utilization to Amazon ECS, and starts and stops tasks whenever it receives a request from Amazon ECS.
You can use Amazon ECS to schedule the placement of container across your cluster based on your resources needs, isolation policies, and availability requirements. Amazon ECS eliminates the need for you to operate your own cluster management and configuration management systems or worry about scaling your management infrastructure.
Features of Amazon ECS
Amazon ECS is a regional service that simplifies running application containers in a highly available manner across multilpe Availability Zones (AZ) withing a Resion. You can create the Amazon ECS clusters within a new or existing VPC. After a cluster is up and running , you can define task definations and services that specify which Docker container images to run across your clusters. Container images are stored in and pulled from container registries, which my exist within or outside of your AWS infrastructure.
Container and Images
To deploy applications on Amazon ECS, your application components must be architected to run in containers. A Docker container is a standardized unit of software development, containing everything that your software application needs to run: code, runtime, system tools, system libraries, etc. Containers are created from a read-only template called an image.
Images are typically built from a Dockerfile, a plain text file that specifies all of the components that are included in the container. These images are then stored in a registry from which they can be downloaded and run on your cluster.
To prepare your application to run on Amazon ECS, you create a task definition. The task definition is a text file, in JSON format, that describes one or more containers, up to a maximum of ten, that form your application. It can be thought of as a blueprint for your application. Task definitions specify various parameters for your application. Examples of task definition parameters are which containers to use, which launch type to use, which ports should be opened for your application, and what data volumes should be used with the containers in the task. The specific parameters available for the task definition depend on which launch type you are using. For more information about creating task definitions, see Amazon ECS Task Definitions.
{
"family": "webserver",
"containerDefinitions": [
{
"name": "web",
"image": "nginx",
"memory": "100",
"cpu": "99"
},
],
"requiresCompatibilities": [
"FARGATE"
],
"networkMode": "awsvpc",
"memory": "512",
"cpu": "256",
}
Tasks and Scheduling
A task is the instantiation of a task definition within a cluster. After you have created a task definition for your application within Amazon ECS, you can specify the number of tasks that will run on your cluster. Each task that uses the Fargate launch type has its own isolation boundary and does not share the underlying kernel, CPU resources, memory resources, or elastic network interface with another task. The Amazon ECS task scheduler is responsible for placing tasks within your cluster. There are several different scheduling options available. For example, you can define a service that runs and maintains a specified number of tasks simultaneously.
Clusters
When you run tasks using Amazon ECS, you place them on a cluster, which is a logical grouping of resources. When using the Fargate launch type with tasks within your cluster, Amazon ECS manages your cluster resources. When using the EC2 launch type, then your clusters are a group of container instances you manage. An Amazon ECS container instance is an Amazon EC2 instance that is running the Amazon ECS container agent. Amazon ECS downloads your container images from a registry that you specify, and runs those images within your cluster.
Container Agent
The container agent runs on each infrastructure resource within an Amazon ECS cluster. It sends information about the resource's current running tasks and resource utilization to Amazon ECS, and starts and stops tasks whenever it receives a request from Amazon ECS.
Introduction To AWS
Amazon Web Services (AWS) is a subsidiary of Amazon that provides on demand cloud computing platforms and APIs to individuals , companies, and governments, on a metered pay-as-you-go basis.
Subscribe to:
Posts (Atom)