amazon-web-services

Topics related to amazon-web-services:

Getting started with amazon-web-services

This section provides an overview of what amazon-web-services is, and why a developer might want to use it.

It should also mention any large subjects within amazon-web-services, and link out to the related topics. Since the Documentation for amazon-web-services is new, you may need to create initial versions of those related topics.

Amazon Cognito

Amazon DynamoDB

AWS CloudFormation

Elastic Beanstalk

Root Class

Deploy a docker container image using ECS

Before you can add ECS instances to a cluster you must first go to the EC2 Management Console and create ecs-optimized instances with an IAM role that has the AmazonEC2ContainerServiceforEC2Role policy attached.

  1. Go to your EC2 Dashboard, and click the Launch Instance button.
  2. Under Community AMIs, search for ecs-optimized, and select the one that best fits your project needs. Any will work. Click next.
  3. When you get to Configure Instance Details, click on the create new IAM role link and create a new role called ecsInstanceRole.
  4. Attach the AmazonEC2ContainerServiceforEC2Role policy to that role.
  5. By default, your container instance launches into your default cluster. If you want to launch into your own cluster instead of the default, choose the Advanced Details list and paste the following script into the User data field, replacing your_cluster_name with the name of your cluster.
#!/bin/bash
echo ECS_CLUSTER=your_cluster_name >> /etc/ecs/ecs.config
  1. Then, finish configuring your ECS Instance.

NOTE: If you a creating a web server you will want to create a securityGroup to allow access to port 80.

  1. Create a Repository: aws ecr create-repository --repository-name example-repository
  2. Authenticate your Docker client to your registry: aws ecr get-login --region us-east-1 | sh
  3. Build your Docker image: docker build -t example-image .
  4. Tag your image so you can push the image to this repository: docker tag example-image:latest example-namespace/example-image:latest
  5. Push this image to your newly created AWS repository: docker push example-namespace/example-image:latest
  6. Register an ECS Task Definition: aws ecs register-task-definition --cli-input-json example-task.json
  7. Run the task: aws ecs run-task --task-definition example-task

AWS Lambda

  • AWS Lambda code must be written in a stateless manner. While the instance of a lambda might be retained and re-used, you must never expect this.