Difference between revisions of "Aws ecs"

From Wasya Wiki
Jump to: navigation, search
(Created page with " * From: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_AWSCLI_Fargate.html * From: https://stackoverflow.com/questions/52310447/is-it-possible-to-ssh-into-fa...")
 
Line 2: Line 2:
 
* From: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_AWSCLI_Fargate.html
 
* From: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_AWSCLI_Fargate.html
 
* From: https://stackoverflow.com/questions/52310447/is-it-possible-to-ssh-into-fargate-managed-container-instances
 
* From: https://stackoverflow.com/questions/52310447/is-it-possible-to-ssh-into-fargate-managed-container-instances
 
+
* From: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/using_awslogs.html
 +
* Install session manager: From: https://docs.aws.amazon.com/systems-manager/latest/userguide/install-plugin-macos-overview.html#install-plugin-macos
  
 
   aws ecs create-cluster --cluster-name fragile-cluster
 
   aws ecs create-cluster --cluster-name fragile-cluster
Line 12: Line 13:
  
 
   aws ecs list-task-definitions --profile ecs_driver_1
 
   aws ecs list-task-definitions --profile ecs_driver_1
 
 
 
  
  
Line 35: Line 33:
 
     ]
 
     ]
 
}
 
}
 +
</pre>
 +
 +
 +
 +
 +
<pre>
 +
aws ecs create-service --cluster fragile-cluster \
 +
  --service-name example \
 +
  --task-definition example:1 \
 +
  --desired-count 1 \
 +
  --launch-type "FARGATE" \
 +
  --enable-execute-command \
 +
  --network-configuration "awsvpcConfiguration={subnets=[subnet-002cfddc88821739a],securityGroups=[sg-0cab3a81fc072e563],assignPublicIp=ENABLED}" \
 +
  --profile ecs_driver_1
 +
</pre>
 +
 +
 +
  aws ecs list-services --cluster fragile-cluster --profile ecs_driver_1
 +
 +
  aws ecs delete-service --cluster fragile-cluster --service helloworld5 --force --profile ecs_driver_1
 +
 +
<pre>
 +
aws ecs update-service --service helloworld \
 +
  --cluster fragile-cluster \
 +
  --enable-execute-command \
 +
  --force-new-deployment \
 +
  --profile ecs_driver_1
 +
</pre>
 +
 +
 +
  aws ecs describe-services --cluster fragile-cluster --services example --profile ecs_driver_1
 +
 +
 +
 +
 +
  aws ecs list-tasks --cluster fragile-cluster --service example --profile ecs_driver_1
 +
 +
<pre>
 +
aws ecs describe-tasks --cluster fragile-cluster \
 +
  --tasks arn:aws:ecs:us-east-1:831556125887:task/fragile-cluster/441a779b54b94091a73ce5398d1d4cc0 \
 +
  --profile ecs_driver_1
 +
</pre>
 +
 +
  aws ec2 describe-network-interfaces --network-interface-id  eni-0e7c054a10e449ca4  --profile ecs_driver_1
 +
 +
  aws ecs delete-cluster --cluster fragile-cluster
 +
 +
<pre>
 +
aws ecs execute-command  \
 +
  --region us-east-1 \
 +
  --cluster fragile-cluster \
 +
  --task 441a779b54b94091a73ce5398d1d4cc0 \
 +
  --container f6f12b80-115a-4320-bf26-603bd6605d8f \
 +
  --command "/bin/bash" \
 +
  --interactive \
 +
  --profile ecs_driver_1
 
</pre>
 
</pre>

Revision as of 17:49, 28 March 2024

 aws ecs create-cluster --cluster-name fragile-cluster


 aws ecs register-task-definition --cli-input-json file:////Users/piousbox/projects/ruby/wco_models/app/views/wco_hosting/ecs_task_definitions/hw1.json --profile ecs_driver_1
 aws ecs register-task-definition --cli-input-json file:////Users/piousbox/projects/ruby/wco_models/app/views/wco_hosting/ecs_task_definitions/example1.json --profile ecs_driver_1
 aws ecs list-task-definitions --profile ecs_driver_1


// trust relationships

{
    "Version": "2008-10-17",
    "Statement": [
        {
            "Sid": "a",
            "Effect": "Allow",
            "Principal": {
                "Service": [
                    "ecs.amazonaws.com",
                    "ecs-tasks.amazonaws.com"
                ]
            },
            "Action": "sts:AssumeRole"
        }
    ]
}



aws ecs create-service --cluster fragile-cluster \
  --service-name example \
  --task-definition example:1 \
  --desired-count 1 \
  --launch-type "FARGATE" \
  --enable-execute-command \
  --network-configuration "awsvpcConfiguration={subnets=[subnet-002cfddc88821739a],securityGroups=[sg-0cab3a81fc072e563],assignPublicIp=ENABLED}" \
  --profile ecs_driver_1


 aws ecs list-services --cluster fragile-cluster --profile ecs_driver_1
 aws ecs delete-service --cluster fragile-cluster --service helloworld5 --force --profile ecs_driver_1
aws ecs update-service --service helloworld \
  --cluster fragile-cluster \
  --enable-execute-command \
  --force-new-deployment \
  --profile ecs_driver_1


 aws ecs describe-services --cluster fragile-cluster --services example --profile ecs_driver_1



 aws ecs list-tasks --cluster fragile-cluster --service example --profile ecs_driver_1
aws ecs describe-tasks --cluster fragile-cluster \
  --tasks arn:aws:ecs:us-east-1:831556125887:task/fragile-cluster/441a779b54b94091a73ce5398d1d4cc0 \
  --profile ecs_driver_1
 aws ec2 describe-network-interfaces --network-interface-id  eni-0e7c054a10e449ca4  --profile ecs_driver_1
 aws ecs delete-cluster --cluster fragile-cluster
aws ecs execute-command  \
  --region us-east-1 \
  --cluster fragile-cluster \
  --task 441a779b54b94091a73ce5398d1d4cc0 \
  --container f6f12b80-115a-4320-bf26-603bd6605d8f \
  --command "/bin/bash" \
  --interactive \
  --profile ecs_driver_1