~crunch.io/ubuntu/precise/awscli/unstable

« back to all changes in this revision

Viewing changes to awscli/examples/ecs/register-task-definition.rst

  • Committer: Package Import Robot
  • Author(s): TANIGUCHI Takaki
  • Date: 2015-01-13 23:09:28 UTC
  • mfrom: (3.1.5 sid)
  • Revision ID: package-import@ubuntu.com-20150113230928-uc9exkzqb17ogig0
Tags: 1.7.0-1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
**To register a task definition with a JSON file**
 
2
 
 
3
This example registers a task definition to the specified family with container definitions that are saved in JSON format at the specified file location.
 
4
 
 
5
Command::
 
6
 
 
7
  aws ecs register-task-definition --family sleep360 --container-definitions file://<path_to_json_file>/sleep360.json
 
8
 
 
9
JSON file format::
 
10
 
 
11
  [
 
12
    {
 
13
      "environment": [],
 
14
      "name": "sleep",
 
15
      "image": "busybox",
 
16
      "cpu": 10,
 
17
      "portMappings": [],
 
18
      "entryPoint": [
 
19
        "/bin/sh"
 
20
      ],
 
21
      "memory": 10,
 
22
      "command": [
 
23
        "sleep",
 
24
        "360"
 
25
      ],
 
26
      "essential": true
 
27
    }
 
28
  ]
 
29
 
 
30
Output::
 
31
 
 
32
        {
 
33
            "taskDefinition": {
 
34
                "taskDefinitionArn": "arn:aws:ecs:us-west-2:<aws_account_id>:task-definition/sleep360:2",
 
35
                "containerDefinitions": [
 
36
                    {
 
37
                        "environment": [],
 
38
                        "name": "sleep",
 
39
                        "image": "busybox",
 
40
                        "cpu": 10,
 
41
                        "portMappings": [],
 
42
                        "entryPoint": [
 
43
                            "/bin/sh"
 
44
                        ],
 
45
                        "memory": 10,
 
46
                        "command": [
 
47
                            "sleep",
 
48
                            "360"
 
49
                        ],
 
50
                        "essential": true
 
51
                    }
 
52
                ],
 
53
                "family": "sleep360",
 
54
                "revision": 2
 
55
            }
 
56
        }
 
57
 
 
58
**To register a task definition with a JSON string**
 
59
 
 
60
This example registers a the same task definition from the previous example, but the container definitions are in a string format with the double quotes escaped.
 
61
 
 
62
Command::
 
63
 
 
64
  aws ecs register-task-definition --family sleep360 --container-definitions "[{\"environment\":[],\"name\":\"sleep\",\"image\":\"busybox\",\"cpu\":10,\"portMappings\":[],\"entryPoint\":[\"/bin/sh\"],\"memory\":10,\"command\":[\"sleep\",\"360\"],\"essential\":true}]"
 
65
 
 
66
Output::
 
67
 
 
68
        {
 
69
            "taskDefinition": {
 
70
                "taskDefinitionArn": "arn:aws:ecs:us-west-2:<aws_account_id>:task-definition/sleep360:3",
 
71
                "containerDefinitions": [
 
72
                    {
 
73
                        "environment": [],
 
74
                        "name": "sleep",
 
75
                        "image": "busybox",
 
76
                        "cpu": 10,
 
77
                        "portMappings": [],
 
78
                        "entryPoint": [
 
79
                            "/bin/sh"
 
80
                        ],
 
81
                        "memory": 10,
 
82
                        "command": [
 
83
                            "sleep",
 
84
                            "360"
 
85
                        ],
 
86
                        "essential": true
 
87
                    }
 
88
                ],
 
89
                "family": "sleep360",
 
90
                "revision": 3
 
91
            }
 
92
        }