1# Copyright (c) 2014 Amazon.com, Inc. or its affiliates. All Rights Reserved 2# 3# Permission is hereby granted, free of charge, to any person obtaining a 4# copy of this software and associated documentation files (the 5# "Software"), to deal in the Software without restriction, including 6# without limitation the rights to use, copy, modify, merge, publish, dis- 7# tribute, sublicense, and/or sell copies of the Software, and to permit 8# persons to whom the Software is furnished to do so, subject to the fol- 9# lowing conditions: 10# 11# The above copyright notice and this permission notice shall be included 12# in all copies or substantial portions of the Software. 13# 14# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- 16# ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 17# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 18# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20# IN THE SOFTWARE. 21# 22 23import boto 24from boto.compat import json 25from boto.connection import AWSQueryConnection 26from boto.regioninfo import RegionInfo 27from boto.exception import JSONResponseError 28from boto.opsworks import exceptions 29 30 31class OpsWorksConnection(AWSQueryConnection): 32 """ 33 AWS OpsWorks 34 Welcome to the AWS OpsWorks API Reference . This guide provides 35 descriptions, syntax, and usage examples about AWS OpsWorks 36 actions and data types, including common parameters and error 37 codes. 38 39 AWS OpsWorks is an application management service that provides an 40 integrated experience for overseeing the complete application 41 lifecycle. For information about this product, go to the `AWS 42 OpsWorks`_ details page. 43 44 **SDKs and CLI** 45 46 The most common way to use the AWS OpsWorks API is by using the 47 AWS Command Line Interface (CLI) or by using one of the AWS SDKs 48 to implement applications in your preferred language. For more 49 information, see: 50 51 52 + `AWS CLI`_ 53 + `AWS SDK for Java`_ 54 + `AWS SDK for .NET`_ 55 + `AWS SDK for PHP 2`_ 56 + `AWS SDK for Ruby`_ 57 + `AWS SDK for Node.js`_ 58 + `AWS SDK for Python(Boto)`_ 59 60 61 **Endpoints** 62 63 AWS OpsWorks supports only one endpoint, opsworks.us- 64 east-1.amazonaws.com (HTTPS), so you must connect to that 65 endpoint. You can then use the API to direct AWS OpsWorks to 66 create stacks in any AWS Region. 67 68 **Chef Versions** 69 70 When you call CreateStack, CloneStack, or UpdateStack we recommend 71 you use the `ConfigurationManager` parameter to specify the Chef 72 version, 0.9, 11.4, or 11.10. The default value is currently 73 11.10. For more information, see `Chef Versions`_. 74 75 You can still specify Chef 0.9 for your stack, but new features 76 are not available for Chef 0.9 stacks, and support is scheduled to 77 end on July 24, 2014. We do not recommend using Chef 0.9 for new 78 stacks, and we recommend migrating your existing Chef 0.9 stacks 79 to Chef 11.10 as soon as possible. 80 """ 81 APIVersion = "2013-02-18" 82 DefaultRegionName = "us-east-1" 83 DefaultRegionEndpoint = "opsworks.us-east-1.amazonaws.com" 84 ServiceName = "OpsWorks" 85 TargetPrefix = "OpsWorks_20130218" 86 ResponseError = JSONResponseError 87 88 _faults = { 89 "ResourceNotFoundException": exceptions.ResourceNotFoundException, 90 "ValidationException": exceptions.ValidationException, 91 } 92 93 94 def __init__(self, **kwargs): 95 region = kwargs.pop('region', None) 96 if not region: 97 region = RegionInfo(self, self.DefaultRegionName, 98 self.DefaultRegionEndpoint) 99 100 if 'host' not in kwargs or kwargs['host'] is None: 101 kwargs['host'] = region.endpoint 102 103 super(OpsWorksConnection, self).__init__(**kwargs) 104 self.region = region 105 106 def _required_auth_capability(self): 107 return ['hmac-v4'] 108 109 def assign_instance(self, instance_id, layer_ids): 110 """ 111 Assign a registered instance to a custom layer. You cannot use 112 this action with instances that were created with AWS 113 OpsWorks. 114 115 **Required Permissions**: To use this action, an IAM user must 116 have a Manage permissions level for the stack or an attached 117 policy that explicitly grants permissions. For more 118 information on user permissions, see `Managing User 119 Permissions`_. 120 121 :type instance_id: string 122 :param instance_id: The instance ID. 123 124 :type layer_ids: list 125 :param layer_ids: The layer ID, which must correspond to a custom 126 layer. You cannot assign a registered instance to a built-in layer. 127 128 """ 129 params = { 130 'InstanceId': instance_id, 131 'LayerIds': layer_ids, 132 } 133 return self.make_request(action='AssignInstance', 134 body=json.dumps(params)) 135 136 def assign_volume(self, volume_id, instance_id=None): 137 """ 138 Assigns one of the stack's registered Amazon EBS volumes to a 139 specified instance. The volume must first be registered with 140 the stack by calling RegisterVolume. For more information, see 141 `Resource Management`_. 142 143 **Required Permissions**: To use this action, an IAM user must 144 have a Manage permissions level for the stack, or an attached 145 policy that explicitly grants permissions. For more 146 information on user permissions, see `Managing User 147 Permissions`_. 148 149 :type volume_id: string 150 :param volume_id: The volume ID. 151 152 :type instance_id: string 153 :param instance_id: The instance ID. 154 155 """ 156 params = {'VolumeId': volume_id, } 157 if instance_id is not None: 158 params['InstanceId'] = instance_id 159 return self.make_request(action='AssignVolume', 160 body=json.dumps(params)) 161 162 def associate_elastic_ip(self, elastic_ip, instance_id=None): 163 """ 164 Associates one of the stack's registered Elastic IP addresses 165 with a specified instance. The address must first be 166 registered with the stack by calling RegisterElasticIp. For 167 more information, see `Resource Management`_. 168 169 **Required Permissions**: To use this action, an IAM user must 170 have a Manage permissions level for the stack, or an attached 171 policy that explicitly grants permissions. For more 172 information on user permissions, see `Managing User 173 Permissions`_. 174 175 :type elastic_ip: string 176 :param elastic_ip: The Elastic IP address. 177 178 :type instance_id: string 179 :param instance_id: The instance ID. 180 181 """ 182 params = {'ElasticIp': elastic_ip, } 183 if instance_id is not None: 184 params['InstanceId'] = instance_id 185 return self.make_request(action='AssociateElasticIp', 186 body=json.dumps(params)) 187 188 def attach_elastic_load_balancer(self, elastic_load_balancer_name, 189 layer_id): 190 """ 191 Attaches an Elastic Load Balancing load balancer to a 192 specified layer. For more information, see `Elastic Load 193 Balancing`_. 194 195 196 You must create the Elastic Load Balancing instance 197 separately, by using the Elastic Load Balancing console, API, 198 or CLI. For more information, see ` Elastic Load Balancing 199 Developer Guide`_. 200 201 202 **Required Permissions**: To use this action, an IAM user must 203 have a Manage permissions level for the stack, or an attached 204 policy that explicitly grants permissions. For more 205 information on user permissions, see `Managing User 206 Permissions`_. 207 208 :type elastic_load_balancer_name: string 209 :param elastic_load_balancer_name: The Elastic Load Balancing 210 instance's name. 211 212 :type layer_id: string 213 :param layer_id: The ID of the layer that the Elastic Load Balancing 214 instance is to be attached to. 215 216 """ 217 params = { 218 'ElasticLoadBalancerName': elastic_load_balancer_name, 219 'LayerId': layer_id, 220 } 221 return self.make_request(action='AttachElasticLoadBalancer', 222 body=json.dumps(params)) 223 224 def clone_stack(self, source_stack_id, service_role_arn, name=None, 225 region=None, vpc_id=None, attributes=None, 226 default_instance_profile_arn=None, default_os=None, 227 hostname_theme=None, default_availability_zone=None, 228 default_subnet_id=None, custom_json=None, 229 configuration_manager=None, chef_configuration=None, 230 use_custom_cookbooks=None, 231 use_opsworks_security_groups=None, 232 custom_cookbooks_source=None, default_ssh_key_name=None, 233 clone_permissions=None, clone_app_ids=None, 234 default_root_device_type=None): 235 """ 236 Creates a clone of a specified stack. For more information, 237 see `Clone a Stack`_. 238 239 **Required Permissions**: To use this action, an IAM user must 240 have an attached policy that explicitly grants permissions. 241 For more information on user permissions, see `Managing User 242 Permissions`_. 243 244 :type source_stack_id: string 245 :param source_stack_id: The source stack ID. 246 247 :type name: string 248 :param name: The cloned stack name. 249 250 :type region: string 251 :param region: The cloned stack AWS region, such as "us-east-1". For 252 more information about AWS regions, see `Regions and Endpoints`_. 253 254 :type vpc_id: string 255 :param vpc_id: The ID of the VPC that the cloned stack is to be 256 launched into. It must be in the specified region. All instances 257 are launched into this VPC, and you cannot change the ID later. 258 259 + If your account supports EC2 Classic, the default value is no VPC. 260 + If your account does not support EC2 Classic, the default value is 261 the default VPC for the specified region. 262 263 264 If the VPC ID corresponds to a default VPC and you have specified 265 either the `DefaultAvailabilityZone` or the `DefaultSubnetId` 266 parameter only, AWS OpsWorks infers the value of the other 267 parameter. If you specify neither parameter, AWS OpsWorks sets 268 these parameters to the first valid Availability Zone for the 269 specified region and the corresponding default VPC subnet ID, 270 respectively. 271 272 If you specify a nondefault VPC ID, note the following: 273 274 275 + It must belong to a VPC in your account that is in the specified 276 region. 277 + You must specify a value for `DefaultSubnetId`. 278 279 280 For more information on how to use AWS OpsWorks with a VPC, see 281 `Running a Stack in a VPC`_. For more information on default VPC 282 and EC2 Classic, see `Supported Platforms`_. 283 284 :type attributes: map 285 :param attributes: A list of stack attributes and values as key/value 286 pairs to be added to the cloned stack. 287 288 :type service_role_arn: string 289 :param service_role_arn: 290 The stack AWS Identity and Access Management (IAM) role, which allows 291 AWS OpsWorks to work with AWS resources on your behalf. You must 292 set this parameter to the Amazon Resource Name (ARN) for an 293 existing IAM role. If you create a stack by using the AWS OpsWorks 294 console, it creates the role for you. You can obtain an existing 295 stack's IAM ARN programmatically by calling DescribePermissions. 296 For more information about IAM ARNs, see `Using Identifiers`_. 297 298 299 You must set this parameter to a valid service role ARN or the action 300 will fail; there is no default value. You can specify the source 301 stack's service role ARN, if you prefer, but you must do so 302 explicitly. 303 304 :type default_instance_profile_arn: string 305 :param default_instance_profile_arn: The ARN of an IAM profile that is 306 the default profile for all of the stack's EC2 instances. For more 307 information about IAM ARNs, see `Using Identifiers`_. 308 309 :type default_os: string 310 :param default_os: The stacks's operating system, which must be set to 311 one of the following. 312 313 + Standard operating systems: an Amazon Linux version such as `Amazon 314 Linux 2014.09`, `Ubuntu 12.04 LTS`, or `Ubuntu 14.04 LTS`. 315 + Custom AMIs: `Custom`. You specify the custom AMI you want to use 316 when you create instances. 317 318 319 The default option is the current Amazon Linux version. 320 321 :type hostname_theme: string 322 :param hostname_theme: The stack's host name theme, with spaces are 323 replaced by underscores. The theme is used to generate host names 324 for the stack's instances. By default, `HostnameTheme` is set to 325 `Layer_Dependent`, which creates host names by appending integers 326 to the layer's short name. The other themes are: 327 328 + `Baked_Goods` 329 + `Clouds` 330 + `European_Cities` 331 + `Fruits` 332 + `Greek_Deities` 333 + `Legendary_Creatures_from_Japan` 334 + `Planets_and_Moons` 335 + `Roman_Deities` 336 + `Scottish_Islands` 337 + `US_Cities` 338 + `Wild_Cats` 339 340 341 To obtain a generated host name, call `GetHostNameSuggestion`, which 342 returns a host name based on the current theme. 343 344 :type default_availability_zone: string 345 :param default_availability_zone: The cloned stack's default 346 Availability Zone, which must be in the specified region. For more 347 information, see `Regions and Endpoints`_. If you also specify a 348 value for `DefaultSubnetId`, the subnet must be in the same zone. 349 For more information, see the `VpcId` parameter description. 350 351 :type default_subnet_id: string 352 :param default_subnet_id: The stack's default VPC subnet ID. This 353 parameter is required if you specify a value for the `VpcId` 354 parameter. All instances are launched into this subnet unless you 355 specify otherwise when you create the instance. If you also specify 356 a value for `DefaultAvailabilityZone`, the subnet must be in that 357 zone. For information on default values and when this parameter is 358 required, see the `VpcId` parameter description. 359 360 :type custom_json: string 361 :param custom_json: A string that contains user-defined, custom JSON. 362 It is used to override the corresponding default stack 363 configuration JSON values. The string should be in the following 364 format and must escape characters such as '"'.: 365 `"{\"key1\": \"value1\", \"key2\": \"value2\",...}"` 366 367 For more information on custom JSON, see `Use Custom JSON to Modify the 368 Stack Configuration JSON`_ 369 370 :type configuration_manager: dict 371 :param configuration_manager: The configuration manager. When you clone 372 a stack we recommend that you use the configuration manager to 373 specify the Chef version, 0.9, 11.4, or 11.10. The default value is 374 currently 11.4. 375 376 :type chef_configuration: dict 377 :param chef_configuration: A `ChefConfiguration` object that specifies 378 whether to enable Berkshelf and the Berkshelf version on Chef 11.10 379 stacks. For more information, see `Create a New Stack`_. 380 381 :type use_custom_cookbooks: boolean 382 :param use_custom_cookbooks: Whether to use custom cookbooks. 383 384 :type use_opsworks_security_groups: boolean 385 :param use_opsworks_security_groups: Whether to associate the AWS 386 OpsWorks built-in security groups with the stack's layers. 387 AWS OpsWorks provides a standard set of built-in security groups, one 388 for each layer, which are associated with layers by default. With 389 `UseOpsworksSecurityGroups` you can instead provide your own custom 390 security groups. `UseOpsworksSecurityGroups` has the following 391 settings: 392 393 394 + True - AWS OpsWorks automatically associates the appropriate built-in 395 security group with each layer (default setting). You can associate 396 additional security groups with a layer after you create it but you 397 cannot delete the built-in security group. 398 + False - AWS OpsWorks does not associate built-in security groups with 399 layers. You must create appropriate EC2 security groups and 400 associate a security group with each layer that you create. 401 However, you can still manually associate a built-in security group 402 with a layer on creation; custom security groups are required only 403 for those layers that need custom settings. 404 405 406 For more information, see `Create a New Stack`_. 407 408 :type custom_cookbooks_source: dict 409 :param custom_cookbooks_source: Contains the information required to 410 retrieve an app or cookbook from a repository. For more 411 information, see `Creating Apps`_ or `Custom Recipes and 412 Cookbooks`_. 413 414 :type default_ssh_key_name: string 415 :param default_ssh_key_name: A default SSH key for the stack instances. 416 You can override this value when you create or update an instance. 417 418 :type clone_permissions: boolean 419 :param clone_permissions: Whether to clone the source stack's 420 permissions. 421 422 :type clone_app_ids: list 423 :param clone_app_ids: A list of source stack app IDs to be included in 424 the cloned stack. 425 426 :type default_root_device_type: string 427 :param default_root_device_type: The default root device type. This 428 value is used by default for all instances in the cloned stack, but 429 you can override it when you create an instance. For more 430 information, see `Storage for the Root Device`_. 431 432 """ 433 params = { 434 'SourceStackId': source_stack_id, 435 'ServiceRoleArn': service_role_arn, 436 } 437 if name is not None: 438 params['Name'] = name 439 if region is not None: 440 params['Region'] = region 441 if vpc_id is not None: 442 params['VpcId'] = vpc_id 443 if attributes is not None: 444 params['Attributes'] = attributes 445 if default_instance_profile_arn is not None: 446 params['DefaultInstanceProfileArn'] = default_instance_profile_arn 447 if default_os is not None: 448 params['DefaultOs'] = default_os 449 if hostname_theme is not None: 450 params['HostnameTheme'] = hostname_theme 451 if default_availability_zone is not None: 452 params['DefaultAvailabilityZone'] = default_availability_zone 453 if default_subnet_id is not None: 454 params['DefaultSubnetId'] = default_subnet_id 455 if custom_json is not None: 456 params['CustomJson'] = custom_json 457 if configuration_manager is not None: 458 params['ConfigurationManager'] = configuration_manager 459 if chef_configuration is not None: 460 params['ChefConfiguration'] = chef_configuration 461 if use_custom_cookbooks is not None: 462 params['UseCustomCookbooks'] = use_custom_cookbooks 463 if use_opsworks_security_groups is not None: 464 params['UseOpsworksSecurityGroups'] = use_opsworks_security_groups 465 if custom_cookbooks_source is not None: 466 params['CustomCookbooksSource'] = custom_cookbooks_source 467 if default_ssh_key_name is not None: 468 params['DefaultSshKeyName'] = default_ssh_key_name 469 if clone_permissions is not None: 470 params['ClonePermissions'] = clone_permissions 471 if clone_app_ids is not None: 472 params['CloneAppIds'] = clone_app_ids 473 if default_root_device_type is not None: 474 params['DefaultRootDeviceType'] = default_root_device_type 475 return self.make_request(action='CloneStack', 476 body=json.dumps(params)) 477 478 def create_app(self, stack_id, name, type, shortname=None, 479 description=None, data_sources=None, app_source=None, 480 domains=None, enable_ssl=None, ssl_configuration=None, 481 attributes=None, environment=None): 482 """ 483 Creates an app for a specified stack. For more information, 484 see `Creating Apps`_. 485 486 **Required Permissions**: To use this action, an IAM user must 487 have a Manage permissions level for the stack, or an attached 488 policy that explicitly grants permissions. For more 489 information on user permissions, see `Managing User 490 Permissions`_. 491 492 :type stack_id: string 493 :param stack_id: The stack ID. 494 495 :type shortname: string 496 :param shortname: The app's short name. 497 498 :type name: string 499 :param name: The app name. 500 501 :type description: string 502 :param description: A description of the app. 503 504 :type data_sources: list 505 :param data_sources: The app's data source. 506 507 :type type: string 508 :param type: The app type. Each supported type is associated with a 509 particular layer. For example, PHP applications are associated with 510 a PHP layer. AWS OpsWorks deploys an application to those instances 511 that are members of the corresponding layer. 512 513 :type app_source: dict 514 :param app_source: A `Source` object that specifies the app repository. 515 516 :type domains: list 517 :param domains: The app virtual host settings, with multiple domains 518 separated by commas. For example: `'www.example.com, example.com'` 519 520 :type enable_ssl: boolean 521 :param enable_ssl: Whether to enable SSL for the app. 522 523 :type ssl_configuration: dict 524 :param ssl_configuration: An `SslConfiguration` object with the SSL 525 configuration. 526 527 :type attributes: map 528 :param attributes: One or more user-defined key/value pairs to be added 529 to the stack attributes. 530 531 :type environment: list 532 :param environment: 533 An array of `EnvironmentVariable` objects that specify environment 534 variables to be associated with the app. You can specify up to ten 535 environment variables. After you deploy the app, these variables 536 are defined on the associated app server instance. 537 538 This parameter is supported only by Chef 11.10 stacks. If you have 539 specified one or more environment variables, you cannot modify the 540 stack's Chef version. 541 542 """ 543 params = {'StackId': stack_id, 'Name': name, 'Type': type, } 544 if shortname is not None: 545 params['Shortname'] = shortname 546 if description is not None: 547 params['Description'] = description 548 if data_sources is not None: 549 params['DataSources'] = data_sources 550 if app_source is not None: 551 params['AppSource'] = app_source 552 if domains is not None: 553 params['Domains'] = domains 554 if enable_ssl is not None: 555 params['EnableSsl'] = enable_ssl 556 if ssl_configuration is not None: 557 params['SslConfiguration'] = ssl_configuration 558 if attributes is not None: 559 params['Attributes'] = attributes 560 if environment is not None: 561 params['Environment'] = environment 562 return self.make_request(action='CreateApp', 563 body=json.dumps(params)) 564 565 def create_deployment(self, stack_id, command, app_id=None, 566 instance_ids=None, comment=None, custom_json=None): 567 """ 568 Runs deployment or stack commands. For more information, see 569 `Deploying Apps`_ and `Run Stack Commands`_. 570 571 **Required Permissions**: To use this action, an IAM user must 572 have a Deploy or Manage permissions level for the stack, or an 573 attached policy that explicitly grants permissions. For more 574 information on user permissions, see `Managing User 575 Permissions`_. 576 577 :type stack_id: string 578 :param stack_id: The stack ID. 579 580 :type app_id: string 581 :param app_id: The app ID. This parameter is required for app 582 deployments, but not for other deployment commands. 583 584 :type instance_ids: list 585 :param instance_ids: The instance IDs for the deployment targets. 586 587 :type command: dict 588 :param command: A `DeploymentCommand` object that specifies the 589 deployment command and any associated arguments. 590 591 :type comment: string 592 :param comment: A user-defined comment. 593 594 :type custom_json: string 595 :param custom_json: A string that contains user-defined, custom JSON. 596 It is used to override the corresponding default stack 597 configuration JSON values. The string should be in the following 598 format and must escape characters such as '"'.: 599 `"{\"key1\": \"value1\", \"key2\": \"value2\",...}"` 600 601 For more information on custom JSON, see `Use Custom JSON to Modify the 602 Stack Configuration JSON`_. 603 604 """ 605 params = {'StackId': stack_id, 'Command': command, } 606 if app_id is not None: 607 params['AppId'] = app_id 608 if instance_ids is not None: 609 params['InstanceIds'] = instance_ids 610 if comment is not None: 611 params['Comment'] = comment 612 if custom_json is not None: 613 params['CustomJson'] = custom_json 614 return self.make_request(action='CreateDeployment', 615 body=json.dumps(params)) 616 617 def create_instance(self, stack_id, layer_ids, instance_type, 618 auto_scaling_type=None, hostname=None, os=None, 619 ami_id=None, ssh_key_name=None, 620 availability_zone=None, virtualization_type=None, 621 subnet_id=None, architecture=None, 622 root_device_type=None, install_updates_on_boot=None, 623 ebs_optimized=None): 624 """ 625 Creates an instance in a specified stack. For more 626 information, see `Adding an Instance to a Layer`_. 627 628 **Required Permissions**: To use this action, an IAM user must 629 have a Manage permissions level for the stack, or an attached 630 policy that explicitly grants permissions. For more 631 information on user permissions, see `Managing User 632 Permissions`_. 633 634 :type stack_id: string 635 :param stack_id: The stack ID. 636 637 :type layer_ids: list 638 :param layer_ids: An array that contains the instance layer IDs. 639 640 :type instance_type: string 641 :param instance_type: The instance type. AWS OpsWorks supports all 642 instance types except Cluster Compute, Cluster GPU, and High Memory 643 Cluster. For more information, see `Instance Families and Types`_. 644 The parameter values that you use to specify the various types are 645 in the API Name column of the Available Instance Types table. 646 647 :type auto_scaling_type: string 648 :param auto_scaling_type: For load-based or time-based instances, the 649 type. 650 651 :type hostname: string 652 :param hostname: The instance host name. 653 654 :type os: string 655 :param os: The instance's operating system, which must be set to one of 656 the following. 657 658 + Standard operating systems: an Amazon Linux version such as `Amazon 659 Linux 2014.09`, `Ubuntu 12.04 LTS`, or `Ubuntu 14.04 LTS`. 660 + Custom AMIs: `Custom` 661 662 663 The default option is the current Amazon Linux version. If you set this 664 parameter to `Custom`, you must use the CreateInstance action's 665 AmiId parameter to specify the custom AMI that you want to use. For 666 more information on the standard operating systems, see `Operating 667 Systems`_For more information on how to use custom AMIs with 668 OpsWorks, see `Using Custom AMIs`_. 669 670 :type ami_id: string 671 :param ami_id: 672 A custom AMI ID to be used to create the instance. The AMI should be 673 based on one of the standard AWS OpsWorks AMIs: Amazon Linux, 674 Ubuntu 12.04 LTS, or Ubuntu 14.04 LTS. For more information, see 675 `Instances`_. 676 677 If you specify a custom AMI, you must set `Os` to `Custom`. 678 679 :type ssh_key_name: string 680 :param ssh_key_name: The instance SSH key name. 681 682 :type availability_zone: string 683 :param availability_zone: The instance Availability Zone. For more 684 information, see `Regions and Endpoints`_. 685 686 :type virtualization_type: string 687 :param virtualization_type: The instance's virtualization type, 688 `paravirtual` or `hvm`. 689 690 :type subnet_id: string 691 :param subnet_id: The ID of the instance's subnet. If the stack is 692 running in a VPC, you can use this parameter to override the 693 stack's default subnet ID value and direct AWS OpsWorks to launch 694 the instance in a different subnet. 695 696 :type architecture: string 697 :param architecture: The instance architecture. The default option is 698 `x86_64`. Instance types do not necessarily support both 699 architectures. For a list of the architectures that are supported 700 by the different instance types, see `Instance Families and 701 Types`_. 702 703 :type root_device_type: string 704 :param root_device_type: The instance root device type. For more 705 information, see `Storage for the Root Device`_. 706 707 :type install_updates_on_boot: boolean 708 :param install_updates_on_boot: 709 Whether to install operating system and package updates when the 710 instance boots. The default value is `True`. To control when 711 updates are installed, set this value to `False`. You must then 712 update your instances manually by using CreateDeployment to run the 713 `update_dependencies` stack command or manually running `yum` 714 (Amazon Linux) or `apt-get` (Ubuntu) on the instances. 715 716 717 We strongly recommend using the default value of `True` to ensure that 718 your instances have the latest security updates. 719 720 :type ebs_optimized: boolean 721 :param ebs_optimized: Whether to create an Amazon EBS-optimized 722 instance. 723 724 """ 725 params = { 726 'StackId': stack_id, 727 'LayerIds': layer_ids, 728 'InstanceType': instance_type, 729 } 730 if auto_scaling_type is not None: 731 params['AutoScalingType'] = auto_scaling_type 732 if hostname is not None: 733 params['Hostname'] = hostname 734 if os is not None: 735 params['Os'] = os 736 if ami_id is not None: 737 params['AmiId'] = ami_id 738 if ssh_key_name is not None: 739 params['SshKeyName'] = ssh_key_name 740 if availability_zone is not None: 741 params['AvailabilityZone'] = availability_zone 742 if virtualization_type is not None: 743 params['VirtualizationType'] = virtualization_type 744 if subnet_id is not None: 745 params['SubnetId'] = subnet_id 746 if architecture is not None: 747 params['Architecture'] = architecture 748 if root_device_type is not None: 749 params['RootDeviceType'] = root_device_type 750 if install_updates_on_boot is not None: 751 params['InstallUpdatesOnBoot'] = install_updates_on_boot 752 if ebs_optimized is not None: 753 params['EbsOptimized'] = ebs_optimized 754 return self.make_request(action='CreateInstance', 755 body=json.dumps(params)) 756 757 def create_layer(self, stack_id, type, name, shortname, attributes=None, 758 custom_instance_profile_arn=None, 759 custom_security_group_ids=None, packages=None, 760 volume_configurations=None, enable_auto_healing=None, 761 auto_assign_elastic_ips=None, 762 auto_assign_public_ips=None, custom_recipes=None, 763 install_updates_on_boot=None, 764 use_ebs_optimized_instances=None, 765 lifecycle_event_configuration=None): 766 """ 767 Creates a layer. For more information, see `How to Create a 768 Layer`_. 769 770 771 You should use **CreateLayer** for noncustom layer types such 772 as PHP App Server only if the stack does not have an existing 773 layer of that type. A stack can have at most one instance of 774 each noncustom layer; if you attempt to create a second 775 instance, **CreateLayer** fails. A stack can have an arbitrary 776 number of custom layers, so you can call **CreateLayer** as 777 many times as you like for that layer type. 778 779 780 **Required Permissions**: To use this action, an IAM user must 781 have a Manage permissions level for the stack, or an attached 782 policy that explicitly grants permissions. For more 783 information on user permissions, see `Managing User 784 Permissions`_. 785 786 :type stack_id: string 787 :param stack_id: The layer stack ID. 788 789 :type type: string 790 :param type: The layer type. A stack cannot have more than one built-in 791 layer of the same type. It can have any number of custom layers. 792 793 :type name: string 794 :param name: The layer name, which is used by the console. 795 796 :type shortname: string 797 :param shortname: The layer short name, which is used internally by AWS 798 OpsWorks and by Chef recipes. The short name is also used as the 799 name for the directory where your app files are installed. It can 800 have a maximum of 200 characters, which are limited to the 801 alphanumeric characters, '-', '_', and '.'. 802 803 :type attributes: map 804 :param attributes: One or more user-defined key/value pairs to be added 805 to the stack attributes. 806 807 :type custom_instance_profile_arn: string 808 :param custom_instance_profile_arn: The ARN of an IAM profile that to 809 be used for the layer's EC2 instances. For more information about 810 IAM ARNs, see `Using Identifiers`_. 811 812 :type custom_security_group_ids: list 813 :param custom_security_group_ids: An array containing the layer custom 814 security group IDs. 815 816 :type packages: list 817 :param packages: An array of `Package` objects that describe the layer 818 packages. 819 820 :type volume_configurations: list 821 :param volume_configurations: A `VolumeConfigurations` object that 822 describes the layer's Amazon EBS volumes. 823 824 :type enable_auto_healing: boolean 825 :param enable_auto_healing: Whether to disable auto healing for the 826 layer. 827 828 :type auto_assign_elastic_ips: boolean 829 :param auto_assign_elastic_ips: Whether to automatically assign an 830 `Elastic IP address`_ to the layer's instances. For more 831 information, see `How to Edit a Layer`_. 832 833 :type auto_assign_public_ips: boolean 834 :param auto_assign_public_ips: For stacks that are running in a VPC, 835 whether to automatically assign a public IP address to the layer's 836 instances. For more information, see `How to Edit a Layer`_. 837 838 :type custom_recipes: dict 839 :param custom_recipes: A `LayerCustomRecipes` object that specifies the 840 layer custom recipes. 841 842 :type install_updates_on_boot: boolean 843 :param install_updates_on_boot: 844 Whether to install operating system and package updates when the 845 instance boots. The default value is `True`. To control when 846 updates are installed, set this value to `False`. You must then 847 update your instances manually by using CreateDeployment to run the 848 `update_dependencies` stack command or manually running `yum` 849 (Amazon Linux) or `apt-get` (Ubuntu) on the instances. 850 851 852 We strongly recommend using the default value of `True`, to ensure that 853 your instances have the latest security updates. 854 855 :type use_ebs_optimized_instances: boolean 856 :param use_ebs_optimized_instances: Whether to use Amazon EBS-optimized 857 instances. 858 859 :type lifecycle_event_configuration: dict 860 :param lifecycle_event_configuration: A LifeCycleEventConfiguration 861 object that you can use to configure the Shutdown event to specify 862 an execution timeout and enable or disable Elastic Load Balancer 863 connection draining. 864 865 """ 866 params = { 867 'StackId': stack_id, 868 'Type': type, 869 'Name': name, 870 'Shortname': shortname, 871 } 872 if attributes is not None: 873 params['Attributes'] = attributes 874 if custom_instance_profile_arn is not None: 875 params['CustomInstanceProfileArn'] = custom_instance_profile_arn 876 if custom_security_group_ids is not None: 877 params['CustomSecurityGroupIds'] = custom_security_group_ids 878 if packages is not None: 879 params['Packages'] = packages 880 if volume_configurations is not None: 881 params['VolumeConfigurations'] = volume_configurations 882 if enable_auto_healing is not None: 883 params['EnableAutoHealing'] = enable_auto_healing 884 if auto_assign_elastic_ips is not None: 885 params['AutoAssignElasticIps'] = auto_assign_elastic_ips 886 if auto_assign_public_ips is not None: 887 params['AutoAssignPublicIps'] = auto_assign_public_ips 888 if custom_recipes is not None: 889 params['CustomRecipes'] = custom_recipes 890 if install_updates_on_boot is not None: 891 params['InstallUpdatesOnBoot'] = install_updates_on_boot 892 if use_ebs_optimized_instances is not None: 893 params['UseEbsOptimizedInstances'] = use_ebs_optimized_instances 894 if lifecycle_event_configuration is not None: 895 params['LifecycleEventConfiguration'] = lifecycle_event_configuration 896 return self.make_request(action='CreateLayer', 897 body=json.dumps(params)) 898 899 def create_stack(self, name, region, service_role_arn, 900 default_instance_profile_arn, vpc_id=None, 901 attributes=None, default_os=None, hostname_theme=None, 902 default_availability_zone=None, default_subnet_id=None, 903 custom_json=None, configuration_manager=None, 904 chef_configuration=None, use_custom_cookbooks=None, 905 use_opsworks_security_groups=None, 906 custom_cookbooks_source=None, default_ssh_key_name=None, 907 default_root_device_type=None): 908 """ 909 Creates a new stack. For more information, see `Create a New 910 Stack`_. 911 912 **Required Permissions**: To use this action, an IAM user must 913 have an attached policy that explicitly grants permissions. 914 For more information on user permissions, see `Managing User 915 Permissions`_. 916 917 :type name: string 918 :param name: The stack name. 919 920 :type region: string 921 :param region: The stack AWS region, such as "us-east-1". For more 922 information about Amazon regions, see `Regions and Endpoints`_. 923 924 :type vpc_id: string 925 :param vpc_id: The ID of the VPC that the stack is to be launched into. 926 It must be in the specified region. All instances are launched into 927 this VPC, and you cannot change the ID later. 928 929 + If your account supports EC2 Classic, the default value is no VPC. 930 + If your account does not support EC2 Classic, the default value is 931 the default VPC for the specified region. 932 933 934 If the VPC ID corresponds to a default VPC and you have specified 935 either the `DefaultAvailabilityZone` or the `DefaultSubnetId` 936 parameter only, AWS OpsWorks infers the value of the other 937 parameter. If you specify neither parameter, AWS OpsWorks sets 938 these parameters to the first valid Availability Zone for the 939 specified region and the corresponding default VPC subnet ID, 940 respectively. 941 942 If you specify a nondefault VPC ID, note the following: 943 944 945 + It must belong to a VPC in your account that is in the specified 946 region. 947 + You must specify a value for `DefaultSubnetId`. 948 949 950 For more information on how to use AWS OpsWorks with a VPC, see 951 `Running a Stack in a VPC`_. For more information on default VPC 952 and EC2 Classic, see `Supported Platforms`_. 953 954 :type attributes: map 955 :param attributes: One or more user-defined key/value pairs to be added 956 to the stack attributes. 957 958 :type service_role_arn: string 959 :param service_role_arn: The stack AWS Identity and Access Management 960 (IAM) role, which allows AWS OpsWorks to work with AWS resources on 961 your behalf. You must set this parameter to the Amazon Resource 962 Name (ARN) for an existing IAM role. For more information about IAM 963 ARNs, see `Using Identifiers`_. 964 965 :type default_instance_profile_arn: string 966 :param default_instance_profile_arn: The ARN of an IAM profile that is 967 the default profile for all of the stack's EC2 instances. For more 968 information about IAM ARNs, see `Using Identifiers`_. 969 970 :type default_os: string 971 :param default_os: The stack's operating system, which must be set to 972 one of the following. 973 974 + Standard operating systems: an Amazon Linux version such as `Amazon 975 Linux 2014.09`, `Ubuntu 12.04 LTS`, or `Ubuntu 14.04 LTS`. 976 + Custom AMIs: `Custom`. You specify the custom AMI you want to use 977 when you create instances. 978 979 980 The default option is the current Amazon Linux version. 981 982 :type hostname_theme: string 983 :param hostname_theme: The stack's host name theme, with spaces are 984 replaced by underscores. The theme is used to generate host names 985 for the stack's instances. By default, `HostnameTheme` is set to 986 `Layer_Dependent`, which creates host names by appending integers 987 to the layer's short name. The other themes are: 988 989 + `Baked_Goods` 990 + `Clouds` 991 + `European_Cities` 992 + `Fruits` 993 + `Greek_Deities` 994 + `Legendary_Creatures_from_Japan` 995 + `Planets_and_Moons` 996 + `Roman_Deities` 997 + `Scottish_Islands` 998 + `US_Cities` 999 + `Wild_Cats` 1000 1001 1002 To obtain a generated host name, call `GetHostNameSuggestion`, which 1003 returns a host name based on the current theme. 1004 1005 :type default_availability_zone: string 1006 :param default_availability_zone: The stack's default Availability 1007 Zone, which must be in the specified region. For more information, 1008 see `Regions and Endpoints`_. If you also specify a value for 1009 `DefaultSubnetId`, the subnet must be in the same zone. For more 1010 information, see the `VpcId` parameter description. 1011 1012 :type default_subnet_id: string 1013 :param default_subnet_id: The stack's default VPC subnet ID. This 1014 parameter is required if you specify a value for the `VpcId` 1015 parameter. All instances are launched into this subnet unless you 1016 specify otherwise when you create the instance. If you also specify 1017 a value for `DefaultAvailabilityZone`, the subnet must be in that 1018 zone. For information on default values and when this parameter is 1019 required, see the `VpcId` parameter description. 1020 1021 :type custom_json: string 1022 :param custom_json: A string that contains user-defined, custom JSON. 1023 It is used to override the corresponding default stack 1024 configuration JSON values. The string should be in the following 1025 format and must escape characters such as '"'.: 1026 `"{\"key1\": \"value1\", \"key2\": \"value2\",...}"` 1027 1028 For more information on custom JSON, see `Use Custom JSON to Modify the 1029 Stack Configuration JSON`_. 1030 1031 :type configuration_manager: dict 1032 :param configuration_manager: The configuration manager. When you clone 1033 a stack we recommend that you use the configuration manager to 1034 specify the Chef version, 0.9, 11.4, or 11.10. The default value is 1035 currently 11.4. 1036 1037 :type chef_configuration: dict 1038 :param chef_configuration: A `ChefConfiguration` object that specifies 1039 whether to enable Berkshelf and the Berkshelf version on Chef 11.10 1040 stacks. For more information, see `Create a New Stack`_. 1041 1042 :type use_custom_cookbooks: boolean 1043 :param use_custom_cookbooks: Whether the stack uses custom cookbooks. 1044 1045 :type use_opsworks_security_groups: boolean 1046 :param use_opsworks_security_groups: Whether to associate the AWS 1047 OpsWorks built-in security groups with the stack's layers. 1048 AWS OpsWorks provides a standard set of built-in security groups, one 1049 for each layer, which are associated with layers by default. With 1050 `UseOpsworksSecurityGroups` you can instead provide your own custom 1051 security groups. `UseOpsworksSecurityGroups` has the following 1052 settings: 1053 1054 1055 + True - AWS OpsWorks automatically associates the appropriate built-in 1056 security group with each layer (default setting). You can associate 1057 additional security groups with a layer after you create it but you 1058 cannot delete the built-in security group. 1059 + False - AWS OpsWorks does not associate built-in security groups with 1060 layers. You must create appropriate EC2 security groups and 1061 associate a security group with each layer that you create. 1062 However, you can still manually associate a built-in security group 1063 with a layer on creation; custom security groups are required only 1064 for those layers that need custom settings. 1065 1066 1067 For more information, see `Create a New Stack`_. 1068 1069 :type custom_cookbooks_source: dict 1070 :param custom_cookbooks_source: Contains the information required to 1071 retrieve an app or cookbook from a repository. For more 1072 information, see `Creating Apps`_ or `Custom Recipes and 1073 Cookbooks`_. 1074 1075 :type default_ssh_key_name: string 1076 :param default_ssh_key_name: A default SSH key for the stack instances. 1077 You can override this value when you create or update an instance. 1078 1079 :type default_root_device_type: string 1080 :param default_root_device_type: The default root device type. This 1081 value is used by default for all instances in the stack, but you 1082 can override it when you create an instance. The default option is 1083 `instance-store`. For more information, see `Storage for the Root 1084 Device`_. 1085 1086 """ 1087 params = { 1088 'Name': name, 1089 'Region': region, 1090 'ServiceRoleArn': service_role_arn, 1091 'DefaultInstanceProfileArn': default_instance_profile_arn, 1092 } 1093 if vpc_id is not None: 1094 params['VpcId'] = vpc_id 1095 if attributes is not None: 1096 params['Attributes'] = attributes 1097 if default_os is not None: 1098 params['DefaultOs'] = default_os 1099 if hostname_theme is not None: 1100 params['HostnameTheme'] = hostname_theme 1101 if default_availability_zone is not None: 1102 params['DefaultAvailabilityZone'] = default_availability_zone 1103 if default_subnet_id is not None: 1104 params['DefaultSubnetId'] = default_subnet_id 1105 if custom_json is not None: 1106 params['CustomJson'] = custom_json 1107 if configuration_manager is not None: 1108 params['ConfigurationManager'] = configuration_manager 1109 if chef_configuration is not None: 1110 params['ChefConfiguration'] = chef_configuration 1111 if use_custom_cookbooks is not None: 1112 params['UseCustomCookbooks'] = use_custom_cookbooks 1113 if use_opsworks_security_groups is not None: 1114 params['UseOpsworksSecurityGroups'] = use_opsworks_security_groups 1115 if custom_cookbooks_source is not None: 1116 params['CustomCookbooksSource'] = custom_cookbooks_source 1117 if default_ssh_key_name is not None: 1118 params['DefaultSshKeyName'] = default_ssh_key_name 1119 if default_root_device_type is not None: 1120 params['DefaultRootDeviceType'] = default_root_device_type 1121 return self.make_request(action='CreateStack', 1122 body=json.dumps(params)) 1123 1124 def create_user_profile(self, iam_user_arn, ssh_username=None, 1125 ssh_public_key=None, allow_self_management=None): 1126 """ 1127 Creates a new user profile. 1128 1129 **Required Permissions**: To use this action, an IAM user must 1130 have an attached policy that explicitly grants permissions. 1131 For more information on user permissions, see `Managing User 1132 Permissions`_. 1133 1134 :type iam_user_arn: string 1135 :param iam_user_arn: The user's IAM ARN. 1136 1137 :type ssh_username: string 1138 :param ssh_username: The user's SSH user name. The allowable characters 1139 are [a-z], [A-Z], [0-9], '-', and '_'. If the specified name 1140 includes other punctuation marks, AWS OpsWorks removes them. For 1141 example, `my.name` will be changed to `myname`. If you do not 1142 specify an SSH user name, AWS OpsWorks generates one from the IAM 1143 user name. 1144 1145 :type ssh_public_key: string 1146 :param ssh_public_key: The user's public SSH key. 1147 1148 :type allow_self_management: boolean 1149 :param allow_self_management: Whether users can specify their own SSH 1150 public key through the My Settings page. For more information, see 1151 `Setting an IAM User's Public SSH Key`_. 1152 1153 """ 1154 params = {'IamUserArn': iam_user_arn, } 1155 if ssh_username is not None: 1156 params['SshUsername'] = ssh_username 1157 if ssh_public_key is not None: 1158 params['SshPublicKey'] = ssh_public_key 1159 if allow_self_management is not None: 1160 params['AllowSelfManagement'] = allow_self_management 1161 return self.make_request(action='CreateUserProfile', 1162 body=json.dumps(params)) 1163 1164 def delete_app(self, app_id): 1165 """ 1166 Deletes a specified app. 1167 1168 **Required Permissions**: To use this action, an IAM user must 1169 have a Manage permissions level for the stack, or an attached 1170 policy that explicitly grants permissions. For more 1171 information on user permissions, see `Managing User 1172 Permissions`_. 1173 1174 :type app_id: string 1175 :param app_id: The app ID. 1176 1177 """ 1178 params = {'AppId': app_id, } 1179 return self.make_request(action='DeleteApp', 1180 body=json.dumps(params)) 1181 1182 def delete_instance(self, instance_id, delete_elastic_ip=None, 1183 delete_volumes=None): 1184 """ 1185 Deletes a specified instance, which terminates the associated 1186 Amazon EC2 instance. You must stop an instance before you can 1187 delete it. 1188 1189 For more information, see `Deleting Instances`_. 1190 1191 **Required Permissions**: To use this action, an IAM user must 1192 have a Manage permissions level for the stack, or an attached 1193 policy that explicitly grants permissions. For more 1194 information on user permissions, see `Managing User 1195 Permissions`_. 1196 1197 :type instance_id: string 1198 :param instance_id: The instance ID. 1199 1200 :type delete_elastic_ip: boolean 1201 :param delete_elastic_ip: Whether to delete the instance Elastic IP 1202 address. 1203 1204 :type delete_volumes: boolean 1205 :param delete_volumes: Whether to delete the instance's Amazon EBS 1206 volumes. 1207 1208 """ 1209 params = {'InstanceId': instance_id, } 1210 if delete_elastic_ip is not None: 1211 params['DeleteElasticIp'] = delete_elastic_ip 1212 if delete_volumes is not None: 1213 params['DeleteVolumes'] = delete_volumes 1214 return self.make_request(action='DeleteInstance', 1215 body=json.dumps(params)) 1216 1217 def delete_layer(self, layer_id): 1218 """ 1219 Deletes a specified layer. You must first stop and then delete 1220 all associated instances or unassign registered instances. For 1221 more information, see `How to Delete a Layer`_. 1222 1223 **Required Permissions**: To use this action, an IAM user must 1224 have a Manage permissions level for the stack, or an attached 1225 policy that explicitly grants permissions. For more 1226 information on user permissions, see `Managing User 1227 Permissions`_. 1228 1229 :type layer_id: string 1230 :param layer_id: The layer ID. 1231 1232 """ 1233 params = {'LayerId': layer_id, } 1234 return self.make_request(action='DeleteLayer', 1235 body=json.dumps(params)) 1236 1237 def delete_stack(self, stack_id): 1238 """ 1239 Deletes a specified stack. You must first delete all 1240 instances, layers, and apps or deregister registered 1241 instances. For more information, see `Shut Down a Stack`_. 1242 1243 **Required Permissions**: To use this action, an IAM user must 1244 have a Manage permissions level for the stack, or an attached 1245 policy that explicitly grants permissions. For more 1246 information on user permissions, see `Managing User 1247 Permissions`_. 1248 1249 :type stack_id: string 1250 :param stack_id: The stack ID. 1251 1252 """ 1253 params = {'StackId': stack_id, } 1254 return self.make_request(action='DeleteStack', 1255 body=json.dumps(params)) 1256 1257 def delete_user_profile(self, iam_user_arn): 1258 """ 1259 Deletes a user profile. 1260 1261 **Required Permissions**: To use this action, an IAM user must 1262 have an attached policy that explicitly grants permissions. 1263 For more information on user permissions, see `Managing User 1264 Permissions`_. 1265 1266 :type iam_user_arn: string 1267 :param iam_user_arn: The user's IAM ARN. 1268 1269 """ 1270 params = {'IamUserArn': iam_user_arn, } 1271 return self.make_request(action='DeleteUserProfile', 1272 body=json.dumps(params)) 1273 1274 def deregister_elastic_ip(self, elastic_ip): 1275 """ 1276 Deregisters a specified Elastic IP address. The address can 1277 then be registered by another stack. For more information, see 1278 `Resource Management`_. 1279 1280 **Required Permissions**: To use this action, an IAM user must 1281 have a Manage permissions level for the stack, or an attached 1282 policy that explicitly grants permissions. For more 1283 information on user permissions, see `Managing User 1284 Permissions`_. 1285 1286 :type elastic_ip: string 1287 :param elastic_ip: The Elastic IP address. 1288 1289 """ 1290 params = {'ElasticIp': elastic_ip, } 1291 return self.make_request(action='DeregisterElasticIp', 1292 body=json.dumps(params)) 1293 1294 def deregister_instance(self, instance_id): 1295 """ 1296 Deregister a registered Amazon EC2 or on-premises instance. 1297 This action removes the instance from the stack and returns it 1298 to your control. This action can not be used with instances 1299 that were created with AWS OpsWorks. 1300 1301 **Required Permissions**: To use this action, an IAM user must 1302 have a Manage permissions level for the stack or an attached 1303 policy that explicitly grants permissions. For more 1304 information on user permissions, see `Managing User 1305 Permissions`_. 1306 1307 :type instance_id: string 1308 :param instance_id: The instance ID. 1309 1310 """ 1311 params = {'InstanceId': instance_id, } 1312 return self.make_request(action='DeregisterInstance', 1313 body=json.dumps(params)) 1314 1315 def deregister_rds_db_instance(self, rds_db_instance_arn): 1316 """ 1317 Deregisters an Amazon RDS instance. 1318 1319 **Required Permissions**: To use this action, an IAM user must 1320 have a Manage permissions level for the stack, or an attached 1321 policy that explicitly grants permissions. For more 1322 information on user permissions, see `Managing User 1323 Permissions`_. 1324 1325 :type rds_db_instance_arn: string 1326 :param rds_db_instance_arn: The Amazon RDS instance's ARN. 1327 1328 """ 1329 params = {'RdsDbInstanceArn': rds_db_instance_arn, } 1330 return self.make_request(action='DeregisterRdsDbInstance', 1331 body=json.dumps(params)) 1332 1333 def deregister_volume(self, volume_id): 1334 """ 1335 Deregisters an Amazon EBS volume. The volume can then be 1336 registered by another stack. For more information, see 1337 `Resource Management`_. 1338 1339 **Required Permissions**: To use this action, an IAM user must 1340 have a Manage permissions level for the stack, or an attached 1341 policy that explicitly grants permissions. For more 1342 information on user permissions, see `Managing User 1343 Permissions`_. 1344 1345 :type volume_id: string 1346 :param volume_id: The volume ID. 1347 1348 """ 1349 params = {'VolumeId': volume_id, } 1350 return self.make_request(action='DeregisterVolume', 1351 body=json.dumps(params)) 1352 1353 def describe_apps(self, stack_id=None, app_ids=None): 1354 """ 1355 Requests a description of a specified set of apps. 1356 1357 1358 You must specify at least one of the parameters. 1359 1360 1361 **Required Permissions**: To use this action, an IAM user must 1362 have a Show, Deploy, or Manage permissions level for the 1363 stack, or an attached policy that explicitly grants 1364 permissions. For more information on user permissions, see 1365 `Managing User Permissions`_. 1366 1367 :type stack_id: string 1368 :param stack_id: The app stack ID. If you use this parameter, 1369 `DescribeApps` returns a description of the apps in the specified 1370 stack. 1371 1372 :type app_ids: list 1373 :param app_ids: An array of app IDs for the apps to be described. If 1374 you use this parameter, `DescribeApps` returns a description of the 1375 specified apps. Otherwise, it returns a description of every app. 1376 1377 """ 1378 params = {} 1379 if stack_id is not None: 1380 params['StackId'] = stack_id 1381 if app_ids is not None: 1382 params['AppIds'] = app_ids 1383 return self.make_request(action='DescribeApps', 1384 body=json.dumps(params)) 1385 1386 def describe_commands(self, deployment_id=None, instance_id=None, 1387 command_ids=None): 1388 """ 1389 Describes the results of specified commands. 1390 1391 1392 You must specify at least one of the parameters. 1393 1394 1395 **Required Permissions**: To use this action, an IAM user must 1396 have a Show, Deploy, or Manage permissions level for the 1397 stack, or an attached policy that explicitly grants 1398 permissions. For more information on user permissions, see 1399 `Managing User Permissions`_. 1400 1401 :type deployment_id: string 1402 :param deployment_id: The deployment ID. If you include this parameter, 1403 `DescribeCommands` returns a description of the commands associated 1404 with the specified deployment. 1405 1406 :type instance_id: string 1407 :param instance_id: The instance ID. If you include this parameter, 1408 `DescribeCommands` returns a description of the commands associated 1409 with the specified instance. 1410 1411 :type command_ids: list 1412 :param command_ids: An array of command IDs. If you include this 1413 parameter, `DescribeCommands` returns a description of the 1414 specified commands. Otherwise, it returns a description of every 1415 command. 1416 1417 """ 1418 params = {} 1419 if deployment_id is not None: 1420 params['DeploymentId'] = deployment_id 1421 if instance_id is not None: 1422 params['InstanceId'] = instance_id 1423 if command_ids is not None: 1424 params['CommandIds'] = command_ids 1425 return self.make_request(action='DescribeCommands', 1426 body=json.dumps(params)) 1427 1428 def describe_deployments(self, stack_id=None, app_id=None, 1429 deployment_ids=None): 1430 """ 1431 Requests a description of a specified set of deployments. 1432 1433 1434 You must specify at least one of the parameters. 1435 1436 1437 **Required Permissions**: To use this action, an IAM user must 1438 have a Show, Deploy, or Manage permissions level for the 1439 stack, or an attached policy that explicitly grants 1440 permissions. For more information on user permissions, see 1441 `Managing User Permissions`_. 1442 1443 :type stack_id: string 1444 :param stack_id: The stack ID. If you include this parameter, 1445 `DescribeDeployments` returns a description of the commands 1446 associated with the specified stack. 1447 1448 :type app_id: string 1449 :param app_id: The app ID. If you include this parameter, 1450 `DescribeDeployments` returns a description of the commands 1451 associated with the specified app. 1452 1453 :type deployment_ids: list 1454 :param deployment_ids: An array of deployment IDs to be described. If 1455 you include this parameter, `DescribeDeployments` returns a 1456 description of the specified deployments. Otherwise, it returns a 1457 description of every deployment. 1458 1459 """ 1460 params = {} 1461 if stack_id is not None: 1462 params['StackId'] = stack_id 1463 if app_id is not None: 1464 params['AppId'] = app_id 1465 if deployment_ids is not None: 1466 params['DeploymentIds'] = deployment_ids 1467 return self.make_request(action='DescribeDeployments', 1468 body=json.dumps(params)) 1469 1470 def describe_elastic_ips(self, instance_id=None, stack_id=None, ips=None): 1471 """ 1472 Describes `Elastic IP addresses`_. 1473 1474 1475 You must specify at least one of the parameters. 1476 1477 1478 **Required Permissions**: To use this action, an IAM user must 1479 have a Show, Deploy, or Manage permissions level for the 1480 stack, or an attached policy that explicitly grants 1481 permissions. For more information on user permissions, see 1482 `Managing User Permissions`_. 1483 1484 :type instance_id: string 1485 :param instance_id: The instance ID. If you include this parameter, 1486 `DescribeElasticIps` returns a description of the Elastic IP 1487 addresses associated with the specified instance. 1488 1489 :type stack_id: string 1490 :param stack_id: A stack ID. If you include this parameter, 1491 `DescribeElasticIps` returns a description of the Elastic IP 1492 addresses that are registered with the specified stack. 1493 1494 :type ips: list 1495 :param ips: An array of Elastic IP addresses to be described. If you 1496 include this parameter, `DescribeElasticIps` returns a description 1497 of the specified Elastic IP addresses. Otherwise, it returns a 1498 description of every Elastic IP address. 1499 1500 """ 1501 params = {} 1502 if instance_id is not None: 1503 params['InstanceId'] = instance_id 1504 if stack_id is not None: 1505 params['StackId'] = stack_id 1506 if ips is not None: 1507 params['Ips'] = ips 1508 return self.make_request(action='DescribeElasticIps', 1509 body=json.dumps(params)) 1510 1511 def describe_elastic_load_balancers(self, stack_id=None, layer_ids=None): 1512 """ 1513 Describes a stack's Elastic Load Balancing instances. 1514 1515 1516 You must specify at least one of the parameters. 1517 1518 1519 **Required Permissions**: To use this action, an IAM user must 1520 have a Show, Deploy, or Manage permissions level for the 1521 stack, or an attached policy that explicitly grants 1522 permissions. For more information on user permissions, see 1523 `Managing User Permissions`_. 1524 1525 :type stack_id: string 1526 :param stack_id: A stack ID. The action describes the stack's Elastic 1527 Load Balancing instances. 1528 1529 :type layer_ids: list 1530 :param layer_ids: A list of layer IDs. The action describes the Elastic 1531 Load Balancing instances for the specified layers. 1532 1533 """ 1534 params = {} 1535 if stack_id is not None: 1536 params['StackId'] = stack_id 1537 if layer_ids is not None: 1538 params['LayerIds'] = layer_ids 1539 return self.make_request(action='DescribeElasticLoadBalancers', 1540 body=json.dumps(params)) 1541 1542 def describe_instances(self, stack_id=None, layer_id=None, 1543 instance_ids=None): 1544 """ 1545 Requests a description of a set of instances. 1546 1547 1548 You must specify at least one of the parameters. 1549 1550 1551 **Required Permissions**: To use this action, an IAM user must 1552 have a Show, Deploy, or Manage permissions level for the 1553 stack, or an attached policy that explicitly grants 1554 permissions. For more information on user permissions, see 1555 `Managing User Permissions`_. 1556 1557 :type stack_id: string 1558 :param stack_id: A stack ID. If you use this parameter, 1559 `DescribeInstances` returns descriptions of the instances 1560 associated with the specified stack. 1561 1562 :type layer_id: string 1563 :param layer_id: A layer ID. If you use this parameter, 1564 `DescribeInstances` returns descriptions of the instances 1565 associated with the specified layer. 1566 1567 :type instance_ids: list 1568 :param instance_ids: An array of instance IDs to be described. If you 1569 use this parameter, `DescribeInstances` returns a description of 1570 the specified instances. Otherwise, it returns a description of 1571 every instance. 1572 1573 """ 1574 params = {} 1575 if stack_id is not None: 1576 params['StackId'] = stack_id 1577 if layer_id is not None: 1578 params['LayerId'] = layer_id 1579 if instance_ids is not None: 1580 params['InstanceIds'] = instance_ids 1581 return self.make_request(action='DescribeInstances', 1582 body=json.dumps(params)) 1583 1584 def describe_layers(self, stack_id=None, layer_ids=None): 1585 """ 1586 Requests a description of one or more layers in a specified 1587 stack. 1588 1589 1590 You must specify at least one of the parameters. 1591 1592 1593 **Required Permissions**: To use this action, an IAM user must 1594 have a Show, Deploy, or Manage permissions level for the 1595 stack, or an attached policy that explicitly grants 1596 permissions. For more information on user permissions, see 1597 `Managing User Permissions`_. 1598 1599 :type stack_id: string 1600 :param stack_id: The stack ID. 1601 1602 :type layer_ids: list 1603 :param layer_ids: An array of layer IDs that specify the layers to be 1604 described. If you omit this parameter, `DescribeLayers` returns a 1605 description of every layer in the specified stack. 1606 1607 """ 1608 params = {} 1609 if stack_id is not None: 1610 params['StackId'] = stack_id 1611 if layer_ids is not None: 1612 params['LayerIds'] = layer_ids 1613 return self.make_request(action='DescribeLayers', 1614 body=json.dumps(params)) 1615 1616 def describe_load_based_auto_scaling(self, layer_ids): 1617 """ 1618 Describes load-based auto scaling configurations for specified 1619 layers. 1620 1621 1622 You must specify at least one of the parameters. 1623 1624 1625 **Required Permissions**: To use this action, an IAM user must 1626 have a Show, Deploy, or Manage permissions level for the 1627 stack, or an attached policy that explicitly grants 1628 permissions. For more information on user permissions, see 1629 `Managing User Permissions`_. 1630 1631 :type layer_ids: list 1632 :param layer_ids: An array of layer IDs. 1633 1634 """ 1635 params = {'LayerIds': layer_ids, } 1636 return self.make_request(action='DescribeLoadBasedAutoScaling', 1637 body=json.dumps(params)) 1638 1639 def describe_my_user_profile(self): 1640 """ 1641 Describes a user's SSH information. 1642 1643 **Required Permissions**: To use this action, an IAM user must 1644 have self-management enabled or an attached policy that 1645 explicitly grants permissions. For more information on user 1646 permissions, see `Managing User Permissions`_. 1647 1648 1649 """ 1650 params = {} 1651 return self.make_request(action='DescribeMyUserProfile', 1652 body=json.dumps(params)) 1653 1654 def describe_permissions(self, iam_user_arn=None, stack_id=None): 1655 """ 1656 Describes the permissions for a specified stack. 1657 1658 **Required Permissions**: To use this action, an IAM user must 1659 have a Manage permissions level for the stack, or an attached 1660 policy that explicitly grants permissions. For more 1661 information on user permissions, see `Managing User 1662 Permissions`_. 1663 1664 :type iam_user_arn: string 1665 :param iam_user_arn: The user's IAM ARN. For more information about IAM 1666 ARNs, see `Using Identifiers`_. 1667 1668 :type stack_id: string 1669 :param stack_id: The stack ID. 1670 1671 """ 1672 params = {} 1673 if iam_user_arn is not None: 1674 params['IamUserArn'] = iam_user_arn 1675 if stack_id is not None: 1676 params['StackId'] = stack_id 1677 return self.make_request(action='DescribePermissions', 1678 body=json.dumps(params)) 1679 1680 def describe_raid_arrays(self, instance_id=None, stack_id=None, 1681 raid_array_ids=None): 1682 """ 1683 Describe an instance's RAID arrays. 1684 1685 1686 You must specify at least one of the parameters. 1687 1688 1689 **Required Permissions**: To use this action, an IAM user must 1690 have a Show, Deploy, or Manage permissions level for the 1691 stack, or an attached policy that explicitly grants 1692 permissions. For more information on user permissions, see 1693 `Managing User Permissions`_. 1694 1695 :type instance_id: string 1696 :param instance_id: The instance ID. If you use this parameter, 1697 `DescribeRaidArrays` returns descriptions of the RAID arrays 1698 associated with the specified instance. 1699 1700 :type stack_id: string 1701 :param stack_id: The stack ID. 1702 1703 :type raid_array_ids: list 1704 :param raid_array_ids: An array of RAID array IDs. If you use this 1705 parameter, `DescribeRaidArrays` returns descriptions of the 1706 specified arrays. Otherwise, it returns a description of every 1707 array. 1708 1709 """ 1710 params = {} 1711 if instance_id is not None: 1712 params['InstanceId'] = instance_id 1713 if stack_id is not None: 1714 params['StackId'] = stack_id 1715 if raid_array_ids is not None: 1716 params['RaidArrayIds'] = raid_array_ids 1717 return self.make_request(action='DescribeRaidArrays', 1718 body=json.dumps(params)) 1719 1720 def describe_rds_db_instances(self, stack_id, rds_db_instance_arns=None): 1721 """ 1722 Describes Amazon RDS instances. 1723 1724 **Required Permissions**: To use this action, an IAM user must 1725 have a Show, Deploy, or Manage permissions level for the 1726 stack, or an attached policy that explicitly grants 1727 permissions. For more information on user permissions, see 1728 `Managing User Permissions`_. 1729 1730 :type stack_id: string 1731 :param stack_id: The stack ID that the instances are registered with. 1732 The operation returns descriptions of all registered Amazon RDS 1733 instances. 1734 1735 :type rds_db_instance_arns: list 1736 :param rds_db_instance_arns: An array containing the ARNs of the 1737 instances to be described. 1738 1739 """ 1740 params = {'StackId': stack_id, } 1741 if rds_db_instance_arns is not None: 1742 params['RdsDbInstanceArns'] = rds_db_instance_arns 1743 return self.make_request(action='DescribeRdsDbInstances', 1744 body=json.dumps(params)) 1745 1746 def describe_service_errors(self, stack_id=None, instance_id=None, 1747 service_error_ids=None): 1748 """ 1749 Describes AWS OpsWorks service errors. 1750 1751 **Required Permissions**: To use this action, an IAM user must 1752 have a Show, Deploy, or Manage permissions level for the 1753 stack, or an attached policy that explicitly grants 1754 permissions. For more information on user permissions, see 1755 `Managing User Permissions`_. 1756 1757 :type stack_id: string 1758 :param stack_id: The stack ID. If you use this parameter, 1759 `DescribeServiceErrors` returns descriptions of the errors 1760 associated with the specified stack. 1761 1762 :type instance_id: string 1763 :param instance_id: The instance ID. If you use this parameter, 1764 `DescribeServiceErrors` returns descriptions of the errors 1765 associated with the specified instance. 1766 1767 :type service_error_ids: list 1768 :param service_error_ids: An array of service error IDs. If you use 1769 this parameter, `DescribeServiceErrors` returns descriptions of the 1770 specified errors. Otherwise, it returns a description of every 1771 error. 1772 1773 """ 1774 params = {} 1775 if stack_id is not None: 1776 params['StackId'] = stack_id 1777 if instance_id is not None: 1778 params['InstanceId'] = instance_id 1779 if service_error_ids is not None: 1780 params['ServiceErrorIds'] = service_error_ids 1781 return self.make_request(action='DescribeServiceErrors', 1782 body=json.dumps(params)) 1783 1784 def describe_stack_provisioning_parameters(self, stack_id): 1785 """ 1786 Requests a description of a stack's provisioning parameters. 1787 1788 **Required Permissions**: To use this action, an IAM user must 1789 have a Show, Deploy, or Manage permissions level for the stack 1790 or an attached policy that explicitly grants permissions. For 1791 more information on user permissions, see `Managing User 1792 Permissions`_. 1793 1794 :type stack_id: string 1795 :param stack_id: The stack ID 1796 1797 """ 1798 params = {'StackId': stack_id, } 1799 return self.make_request(action='DescribeStackProvisioningParameters', 1800 body=json.dumps(params)) 1801 1802 def describe_stack_summary(self, stack_id): 1803 """ 1804 Describes the number of layers and apps in a specified stack, 1805 and the number of instances in each state, such as 1806 `running_setup` or `online`. 1807 1808 **Required Permissions**: To use this action, an IAM user must 1809 have a Show, Deploy, or Manage permissions level for the 1810 stack, or an attached policy that explicitly grants 1811 permissions. For more information on user permissions, see 1812 `Managing User Permissions`_. 1813 1814 :type stack_id: string 1815 :param stack_id: The stack ID. 1816 1817 """ 1818 params = {'StackId': stack_id, } 1819 return self.make_request(action='DescribeStackSummary', 1820 body=json.dumps(params)) 1821 1822 def describe_stacks(self, stack_ids=None): 1823 """ 1824 Requests a description of one or more stacks. 1825 1826 **Required Permissions**: To use this action, an IAM user must 1827 have a Show, Deploy, or Manage permissions level for the 1828 stack, or an attached policy that explicitly grants 1829 permissions. For more information on user permissions, see 1830 `Managing User Permissions`_. 1831 1832 :type stack_ids: list 1833 :param stack_ids: An array of stack IDs that specify the stacks to be 1834 described. If you omit this parameter, `DescribeStacks` returns a 1835 description of every stack. 1836 1837 """ 1838 params = {} 1839 if stack_ids is not None: 1840 params['StackIds'] = stack_ids 1841 return self.make_request(action='DescribeStacks', 1842 body=json.dumps(params)) 1843 1844 def describe_time_based_auto_scaling(self, instance_ids): 1845 """ 1846 Describes time-based auto scaling configurations for specified 1847 instances. 1848 1849 1850 You must specify at least one of the parameters. 1851 1852 1853 **Required Permissions**: To use this action, an IAM user must 1854 have a Show, Deploy, or Manage permissions level for the 1855 stack, or an attached policy that explicitly grants 1856 permissions. For more information on user permissions, see 1857 `Managing User Permissions`_. 1858 1859 :type instance_ids: list 1860 :param instance_ids: An array of instance IDs. 1861 1862 """ 1863 params = {'InstanceIds': instance_ids, } 1864 return self.make_request(action='DescribeTimeBasedAutoScaling', 1865 body=json.dumps(params)) 1866 1867 def describe_user_profiles(self, iam_user_arns=None): 1868 """ 1869 Describe specified users. 1870 1871 **Required Permissions**: To use this action, an IAM user must 1872 have an attached policy that explicitly grants permissions. 1873 For more information on user permissions, see `Managing User 1874 Permissions`_. 1875 1876 :type iam_user_arns: list 1877 :param iam_user_arns: An array of IAM user ARNs that identify the users 1878 to be described. 1879 1880 """ 1881 params = {} 1882 if iam_user_arns is not None: 1883 params['IamUserArns'] = iam_user_arns 1884 return self.make_request(action='DescribeUserProfiles', 1885 body=json.dumps(params)) 1886 1887 def describe_volumes(self, instance_id=None, stack_id=None, 1888 raid_array_id=None, volume_ids=None): 1889 """ 1890 Describes an instance's Amazon EBS volumes. 1891 1892 1893 You must specify at least one of the parameters. 1894 1895 1896 **Required Permissions**: To use this action, an IAM user must 1897 have a Show, Deploy, or Manage permissions level for the 1898 stack, or an attached policy that explicitly grants 1899 permissions. For more information on user permissions, see 1900 `Managing User Permissions`_. 1901 1902 :type instance_id: string 1903 :param instance_id: The instance ID. If you use this parameter, 1904 `DescribeVolumes` returns descriptions of the volumes associated 1905 with the specified instance. 1906 1907 :type stack_id: string 1908 :param stack_id: A stack ID. The action describes the stack's 1909 registered Amazon EBS volumes. 1910 1911 :type raid_array_id: string 1912 :param raid_array_id: The RAID array ID. If you use this parameter, 1913 `DescribeVolumes` returns descriptions of the volumes associated 1914 with the specified RAID array. 1915 1916 :type volume_ids: list 1917 :param volume_ids: Am array of volume IDs. If you use this parameter, 1918 `DescribeVolumes` returns descriptions of the specified volumes. 1919 Otherwise, it returns a description of every volume. 1920 1921 """ 1922 params = {} 1923 if instance_id is not None: 1924 params['InstanceId'] = instance_id 1925 if stack_id is not None: 1926 params['StackId'] = stack_id 1927 if raid_array_id is not None: 1928 params['RaidArrayId'] = raid_array_id 1929 if volume_ids is not None: 1930 params['VolumeIds'] = volume_ids 1931 return self.make_request(action='DescribeVolumes', 1932 body=json.dumps(params)) 1933 1934 def detach_elastic_load_balancer(self, elastic_load_balancer_name, 1935 layer_id): 1936 """ 1937 Detaches a specified Elastic Load Balancing instance from its 1938 layer. 1939 1940 **Required Permissions**: To use this action, an IAM user must 1941 have a Manage permissions level for the stack, or an attached 1942 policy that explicitly grants permissions. For more 1943 information on user permissions, see `Managing User 1944 Permissions`_. 1945 1946 :type elastic_load_balancer_name: string 1947 :param elastic_load_balancer_name: The Elastic Load Balancing 1948 instance's name. 1949 1950 :type layer_id: string 1951 :param layer_id: The ID of the layer that the Elastic Load Balancing 1952 instance is attached to. 1953 1954 """ 1955 params = { 1956 'ElasticLoadBalancerName': elastic_load_balancer_name, 1957 'LayerId': layer_id, 1958 } 1959 return self.make_request(action='DetachElasticLoadBalancer', 1960 body=json.dumps(params)) 1961 1962 def disassociate_elastic_ip(self, elastic_ip): 1963 """ 1964 Disassociates an Elastic IP address from its instance. The 1965 address remains registered with the stack. For more 1966 information, see `Resource Management`_. 1967 1968 **Required Permissions**: To use this action, an IAM user must 1969 have a Manage permissions level for the stack, or an attached 1970 policy that explicitly grants permissions. For more 1971 information on user permissions, see `Managing User 1972 Permissions`_. 1973 1974 :type elastic_ip: string 1975 :param elastic_ip: The Elastic IP address. 1976 1977 """ 1978 params = {'ElasticIp': elastic_ip, } 1979 return self.make_request(action='DisassociateElasticIp', 1980 body=json.dumps(params)) 1981 1982 def get_hostname_suggestion(self, layer_id): 1983 """ 1984 Gets a generated host name for the specified layer, based on 1985 the current host name theme. 1986 1987 **Required Permissions**: To use this action, an IAM user must 1988 have a Manage permissions level for the stack, or an attached 1989 policy that explicitly grants permissions. For more 1990 information on user permissions, see `Managing User 1991 Permissions`_. 1992 1993 :type layer_id: string 1994 :param layer_id: The layer ID. 1995 1996 """ 1997 params = {'LayerId': layer_id, } 1998 return self.make_request(action='GetHostnameSuggestion', 1999 body=json.dumps(params)) 2000 2001 def reboot_instance(self, instance_id): 2002 """ 2003 Reboots a specified instance. For more information, see 2004 `Starting, Stopping, and Rebooting Instances`_. 2005 2006 **Required Permissions**: To use this action, an IAM user must 2007 have a Manage permissions level for the stack, or an attached 2008 policy that explicitly grants permissions. For more 2009 information on user permissions, see `Managing User 2010 Permissions`_. 2011 2012 :type instance_id: string 2013 :param instance_id: The instance ID. 2014 2015 """ 2016 params = {'InstanceId': instance_id, } 2017 return self.make_request(action='RebootInstance', 2018 body=json.dumps(params)) 2019 2020 def register_elastic_ip(self, elastic_ip, stack_id): 2021 """ 2022 Registers an Elastic IP address with a specified stack. An 2023 address can be registered with only one stack at a time. If 2024 the address is already registered, you must first deregister 2025 it by calling DeregisterElasticIp. For more information, see 2026 `Resource Management`_. 2027 2028 **Required Permissions**: To use this action, an IAM user must 2029 have a Manage permissions level for the stack, or an attached 2030 policy that explicitly grants permissions. For more 2031 information on user permissions, see `Managing User 2032 Permissions`_. 2033 2034 :type elastic_ip: string 2035 :param elastic_ip: The Elastic IP address. 2036 2037 :type stack_id: string 2038 :param stack_id: The stack ID. 2039 2040 """ 2041 params = {'ElasticIp': elastic_ip, 'StackId': stack_id, } 2042 return self.make_request(action='RegisterElasticIp', 2043 body=json.dumps(params)) 2044 2045 def register_instance(self, stack_id, hostname=None, public_ip=None, 2046 private_ip=None, rsa_public_key=None, 2047 rsa_public_key_fingerprint=None, 2048 instance_identity=None): 2049 """ 2050 Registers instances with a specified stack that were created 2051 outside of AWS OpsWorks. 2052 2053 We do not recommend using this action to register instances. 2054 The complete registration operation has two primary steps, 2055 installing the AWS OpsWorks agent on the instance and 2056 registering the instance with the stack. `RegisterInstance` 2057 handles only the second step. You should instead use the AWS 2058 CLI `register` command, which performs the entire registration 2059 operation. 2060 2061 **Required Permissions**: To use this action, an IAM user must 2062 have a Manage permissions level for the stack or an attached 2063 policy that explicitly grants permissions. For more 2064 information on user permissions, see `Managing User 2065 Permissions`_. 2066 2067 :type stack_id: string 2068 :param stack_id: The ID of the stack that the instance is to be 2069 registered with. 2070 2071 :type hostname: string 2072 :param hostname: The instance's hostname. 2073 2074 :type public_ip: string 2075 :param public_ip: The instance's public IP address. 2076 2077 :type private_ip: string 2078 :param private_ip: The instance's private IP address. 2079 2080 :type rsa_public_key: string 2081 :param rsa_public_key: The instances public RSA key. This key is used 2082 to encrypt communication between the instance and the service. 2083 2084 :type rsa_public_key_fingerprint: string 2085 :param rsa_public_key_fingerprint: The instances public RSA key 2086 fingerprint. 2087 2088 :type instance_identity: dict 2089 :param instance_identity: An InstanceIdentity object that contains the 2090 instance's identity. 2091 2092 """ 2093 params = {'StackId': stack_id, } 2094 if hostname is not None: 2095 params['Hostname'] = hostname 2096 if public_ip is not None: 2097 params['PublicIp'] = public_ip 2098 if private_ip is not None: 2099 params['PrivateIp'] = private_ip 2100 if rsa_public_key is not None: 2101 params['RsaPublicKey'] = rsa_public_key 2102 if rsa_public_key_fingerprint is not None: 2103 params['RsaPublicKeyFingerprint'] = rsa_public_key_fingerprint 2104 if instance_identity is not None: 2105 params['InstanceIdentity'] = instance_identity 2106 return self.make_request(action='RegisterInstance', 2107 body=json.dumps(params)) 2108 2109 def register_rds_db_instance(self, stack_id, rds_db_instance_arn, 2110 db_user, db_password): 2111 """ 2112 Registers an Amazon RDS instance with a stack. 2113 2114 **Required Permissions**: To use this action, an IAM user must 2115 have a Manage permissions level for the stack, or an attached 2116 policy that explicitly grants permissions. For more 2117 information on user permissions, see `Managing User 2118 Permissions`_. 2119 2120 :type stack_id: string 2121 :param stack_id: The stack ID. 2122 2123 :type rds_db_instance_arn: string 2124 :param rds_db_instance_arn: The Amazon RDS instance's ARN. 2125 2126 :type db_user: string 2127 :param db_user: The database's master user name. 2128 2129 :type db_password: string 2130 :param db_password: The database password. 2131 2132 """ 2133 params = { 2134 'StackId': stack_id, 2135 'RdsDbInstanceArn': rds_db_instance_arn, 2136 'DbUser': db_user, 2137 'DbPassword': db_password, 2138 } 2139 return self.make_request(action='RegisterRdsDbInstance', 2140 body=json.dumps(params)) 2141 2142 def register_volume(self, stack_id, ec_2_volume_id=None): 2143 """ 2144 Registers an Amazon EBS volume with a specified stack. A 2145 volume can be registered with only one stack at a time. If the 2146 volume is already registered, you must first deregister it by 2147 calling DeregisterVolume. For more information, see `Resource 2148 Management`_. 2149 2150 **Required Permissions**: To use this action, an IAM user must 2151 have a Manage permissions level for the stack, or an attached 2152 policy that explicitly grants permissions. For more 2153 information on user permissions, see `Managing User 2154 Permissions`_. 2155 2156 :type ec_2_volume_id: string 2157 :param ec_2_volume_id: The Amazon EBS volume ID. 2158 2159 :type stack_id: string 2160 :param stack_id: The stack ID. 2161 2162 """ 2163 params = {'StackId': stack_id, } 2164 if ec_2_volume_id is not None: 2165 params['Ec2VolumeId'] = ec_2_volume_id 2166 return self.make_request(action='RegisterVolume', 2167 body=json.dumps(params)) 2168 2169 def set_load_based_auto_scaling(self, layer_id, enable=None, 2170 up_scaling=None, down_scaling=None): 2171 """ 2172 Specify the load-based auto scaling configuration for a 2173 specified layer. For more information, see `Managing Load with 2174 Time-based and Load-based Instances`_. 2175 2176 2177 To use load-based auto scaling, you must create a set of load- 2178 based auto scaling instances. Load-based auto scaling operates 2179 only on the instances from that set, so you must ensure that 2180 you have created enough instances to handle the maximum 2181 anticipated load. 2182 2183 2184 **Required Permissions**: To use this action, an IAM user must 2185 have a Manage permissions level for the stack, or an attached 2186 policy that explicitly grants permissions. For more 2187 information on user permissions, see `Managing User 2188 Permissions`_. 2189 2190 :type layer_id: string 2191 :param layer_id: The layer ID. 2192 2193 :type enable: boolean 2194 :param enable: Enables load-based auto scaling for the layer. 2195 2196 :type up_scaling: dict 2197 :param up_scaling: An `AutoScalingThresholds` object with the upscaling 2198 threshold configuration. If the load exceeds these thresholds for a 2199 specified amount of time, AWS OpsWorks starts a specified number of 2200 instances. 2201 2202 :type down_scaling: dict 2203 :param down_scaling: An `AutoScalingThresholds` object with the 2204 downscaling threshold configuration. If the load falls below these 2205 thresholds for a specified amount of time, AWS OpsWorks stops a 2206 specified number of instances. 2207 2208 """ 2209 params = {'LayerId': layer_id, } 2210 if enable is not None: 2211 params['Enable'] = enable 2212 if up_scaling is not None: 2213 params['UpScaling'] = up_scaling 2214 if down_scaling is not None: 2215 params['DownScaling'] = down_scaling 2216 return self.make_request(action='SetLoadBasedAutoScaling', 2217 body=json.dumps(params)) 2218 2219 def set_permission(self, stack_id, iam_user_arn, allow_ssh=None, 2220 allow_sudo=None, level=None): 2221 """ 2222 Specifies a user's permissions. For more information, see 2223 `Security and Permissions`_. 2224 2225 **Required Permissions**: To use this action, an IAM user must 2226 have a Manage permissions level for the stack, or an attached 2227 policy that explicitly grants permissions. For more 2228 information on user permissions, see `Managing User 2229 Permissions`_. 2230 2231 :type stack_id: string 2232 :param stack_id: The stack ID. 2233 2234 :type iam_user_arn: string 2235 :param iam_user_arn: The user's IAM ARN. 2236 2237 :type allow_ssh: boolean 2238 :param allow_ssh: The user is allowed to use SSH to communicate with 2239 the instance. 2240 2241 :type allow_sudo: boolean 2242 :param allow_sudo: The user is allowed to use **sudo** to elevate 2243 privileges. 2244 2245 :type level: string 2246 :param level: The user's permission level, which must be set to one of 2247 the following strings. You cannot set your own permissions level. 2248 2249 + `deny` 2250 + `show` 2251 + `deploy` 2252 + `manage` 2253 + `iam_only` 2254 2255 2256 For more information on the permissions associated with these levels, 2257 see `Managing User Permissions`_ 2258 2259 """ 2260 params = {'StackId': stack_id, 'IamUserArn': iam_user_arn, } 2261 if allow_ssh is not None: 2262 params['AllowSsh'] = allow_ssh 2263 if allow_sudo is not None: 2264 params['AllowSudo'] = allow_sudo 2265 if level is not None: 2266 params['Level'] = level 2267 return self.make_request(action='SetPermission', 2268 body=json.dumps(params)) 2269 2270 def set_time_based_auto_scaling(self, instance_id, 2271 auto_scaling_schedule=None): 2272 """ 2273 Specify the time-based auto scaling configuration for a 2274 specified instance. For more information, see `Managing Load 2275 with Time-based and Load-based Instances`_. 2276 2277 **Required Permissions**: To use this action, an IAM user must 2278 have a Manage permissions level for the stack, or an attached 2279 policy that explicitly grants permissions. For more 2280 information on user permissions, see `Managing User 2281 Permissions`_. 2282 2283 :type instance_id: string 2284 :param instance_id: The instance ID. 2285 2286 :type auto_scaling_schedule: dict 2287 :param auto_scaling_schedule: An `AutoScalingSchedule` with the 2288 instance schedule. 2289 2290 """ 2291 params = {'InstanceId': instance_id, } 2292 if auto_scaling_schedule is not None: 2293 params['AutoScalingSchedule'] = auto_scaling_schedule 2294 return self.make_request(action='SetTimeBasedAutoScaling', 2295 body=json.dumps(params)) 2296 2297 def start_instance(self, instance_id): 2298 """ 2299 Starts a specified instance. For more information, see 2300 `Starting, Stopping, and Rebooting Instances`_. 2301 2302 **Required Permissions**: To use this action, an IAM user must 2303 have a Manage permissions level for the stack, or an attached 2304 policy that explicitly grants permissions. For more 2305 information on user permissions, see `Managing User 2306 Permissions`_. 2307 2308 :type instance_id: string 2309 :param instance_id: The instance ID. 2310 2311 """ 2312 params = {'InstanceId': instance_id, } 2313 return self.make_request(action='StartInstance', 2314 body=json.dumps(params)) 2315 2316 def start_stack(self, stack_id): 2317 """ 2318 Starts a stack's instances. 2319 2320 **Required Permissions**: To use this action, an IAM user must 2321 have a Manage permissions level for the stack, or an attached 2322 policy that explicitly grants permissions. For more 2323 information on user permissions, see `Managing User 2324 Permissions`_. 2325 2326 :type stack_id: string 2327 :param stack_id: The stack ID. 2328 2329 """ 2330 params = {'StackId': stack_id, } 2331 return self.make_request(action='StartStack', 2332 body=json.dumps(params)) 2333 2334 def stop_instance(self, instance_id): 2335 """ 2336 Stops a specified instance. When you stop a standard instance, 2337 the data disappears and must be reinstalled when you restart 2338 the instance. You can stop an Amazon EBS-backed instance 2339 without losing data. For more information, see `Starting, 2340 Stopping, and Rebooting Instances`_. 2341 2342 **Required Permissions**: To use this action, an IAM user must 2343 have a Manage permissions level for the stack, or an attached 2344 policy that explicitly grants permissions. For more 2345 information on user permissions, see `Managing User 2346 Permissions`_. 2347 2348 :type instance_id: string 2349 :param instance_id: The instance ID. 2350 2351 """ 2352 params = {'InstanceId': instance_id, } 2353 return self.make_request(action='StopInstance', 2354 body=json.dumps(params)) 2355 2356 def stop_stack(self, stack_id): 2357 """ 2358 Stops a specified stack. 2359 2360 **Required Permissions**: To use this action, an IAM user must 2361 have a Manage permissions level for the stack, or an attached 2362 policy that explicitly grants permissions. For more 2363 information on user permissions, see `Managing User 2364 Permissions`_. 2365 2366 :type stack_id: string 2367 :param stack_id: The stack ID. 2368 2369 """ 2370 params = {'StackId': stack_id, } 2371 return self.make_request(action='StopStack', 2372 body=json.dumps(params)) 2373 2374 def unassign_instance(self, instance_id): 2375 """ 2376 Unassigns a registered instance from all of it's layers. The 2377 instance remains in the stack as an unassigned instance and 2378 can be assigned to another layer, as needed. You cannot use 2379 this action with instances that were created with AWS 2380 OpsWorks. 2381 2382 **Required Permissions**: To use this action, an IAM user must 2383 have a Manage permissions level for the stack or an attached 2384 policy that explicitly grants permissions. For more 2385 information on user permissions, see `Managing User 2386 Permissions`_. 2387 2388 :type instance_id: string 2389 :param instance_id: The instance ID. 2390 2391 """ 2392 params = {'InstanceId': instance_id, } 2393 return self.make_request(action='UnassignInstance', 2394 body=json.dumps(params)) 2395 2396 def unassign_volume(self, volume_id): 2397 """ 2398 Unassigns an assigned Amazon EBS volume. The volume remains 2399 registered with the stack. For more information, see `Resource 2400 Management`_. 2401 2402 **Required Permissions**: To use this action, an IAM user must 2403 have a Manage permissions level for the stack, or an attached 2404 policy that explicitly grants permissions. For more 2405 information on user permissions, see `Managing User 2406 Permissions`_. 2407 2408 :type volume_id: string 2409 :param volume_id: The volume ID. 2410 2411 """ 2412 params = {'VolumeId': volume_id, } 2413 return self.make_request(action='UnassignVolume', 2414 body=json.dumps(params)) 2415 2416 def update_app(self, app_id, name=None, description=None, 2417 data_sources=None, type=None, app_source=None, 2418 domains=None, enable_ssl=None, ssl_configuration=None, 2419 attributes=None, environment=None): 2420 """ 2421 Updates a specified app. 2422 2423 **Required Permissions**: To use this action, an IAM user must 2424 have a Deploy or Manage permissions level for the stack, or an 2425 attached policy that explicitly grants permissions. For more 2426 information on user permissions, see `Managing User 2427 Permissions`_. 2428 2429 :type app_id: string 2430 :param app_id: The app ID. 2431 2432 :type name: string 2433 :param name: The app name. 2434 2435 :type description: string 2436 :param description: A description of the app. 2437 2438 :type data_sources: list 2439 :param data_sources: The app's data sources. 2440 2441 :type type: string 2442 :param type: The app type. 2443 2444 :type app_source: dict 2445 :param app_source: A `Source` object that specifies the app repository. 2446 2447 :type domains: list 2448 :param domains: The app's virtual host settings, with multiple domains 2449 separated by commas. For example: `'www.example.com, example.com'` 2450 2451 :type enable_ssl: boolean 2452 :param enable_ssl: Whether SSL is enabled for the app. 2453 2454 :type ssl_configuration: dict 2455 :param ssl_configuration: An `SslConfiguration` object with the SSL 2456 configuration. 2457 2458 :type attributes: map 2459 :param attributes: One or more user-defined key/value pairs to be added 2460 to the stack attributes. 2461 2462 :type environment: list 2463 :param environment: 2464 An array of `EnvironmentVariable` objects that specify environment 2465 variables to be associated with the app. You can specify up to ten 2466 environment variables. After you deploy the app, these variables 2467 are defined on the associated app server instances. 2468 2469 This parameter is supported only by Chef 11.10 stacks. If you have 2470 specified one or more environment variables, you cannot modify the 2471 stack's Chef version. 2472 2473 """ 2474 params = {'AppId': app_id, } 2475 if name is not None: 2476 params['Name'] = name 2477 if description is not None: 2478 params['Description'] = description 2479 if data_sources is not None: 2480 params['DataSources'] = data_sources 2481 if type is not None: 2482 params['Type'] = type 2483 if app_source is not None: 2484 params['AppSource'] = app_source 2485 if domains is not None: 2486 params['Domains'] = domains 2487 if enable_ssl is not None: 2488 params['EnableSsl'] = enable_ssl 2489 if ssl_configuration is not None: 2490 params['SslConfiguration'] = ssl_configuration 2491 if attributes is not None: 2492 params['Attributes'] = attributes 2493 if environment is not None: 2494 params['Environment'] = environment 2495 return self.make_request(action='UpdateApp', 2496 body=json.dumps(params)) 2497 2498 def update_elastic_ip(self, elastic_ip, name=None): 2499 """ 2500 Updates a registered Elastic IP address's name. For more 2501 information, see `Resource Management`_. 2502 2503 **Required Permissions**: To use this action, an IAM user must 2504 have a Manage permissions level for the stack, or an attached 2505 policy that explicitly grants permissions. For more 2506 information on user permissions, see `Managing User 2507 Permissions`_. 2508 2509 :type elastic_ip: string 2510 :param elastic_ip: The address. 2511 2512 :type name: string 2513 :param name: The new name. 2514 2515 """ 2516 params = {'ElasticIp': elastic_ip, } 2517 if name is not None: 2518 params['Name'] = name 2519 return self.make_request(action='UpdateElasticIp', 2520 body=json.dumps(params)) 2521 2522 def update_instance(self, instance_id, layer_ids=None, 2523 instance_type=None, auto_scaling_type=None, 2524 hostname=None, os=None, ami_id=None, 2525 ssh_key_name=None, architecture=None, 2526 install_updates_on_boot=None, ebs_optimized=None): 2527 """ 2528 Updates a specified instance. 2529 2530 **Required Permissions**: To use this action, an IAM user must 2531 have a Manage permissions level for the stack, or an attached 2532 policy that explicitly grants permissions. For more 2533 information on user permissions, see `Managing User 2534 Permissions`_. 2535 2536 :type instance_id: string 2537 :param instance_id: The instance ID. 2538 2539 :type layer_ids: list 2540 :param layer_ids: The instance's layer IDs. 2541 2542 :type instance_type: string 2543 :param instance_type: The instance type. AWS OpsWorks supports all 2544 instance types except Cluster Compute, Cluster GPU, and High Memory 2545 Cluster. For more information, see `Instance Families and Types`_. 2546 The parameter values that you use to specify the various types are 2547 in the API Name column of the Available Instance Types table. 2548 2549 :type auto_scaling_type: string 2550 :param auto_scaling_type: For load-based or time-based instances, the 2551 type. 2552 2553 :type hostname: string 2554 :param hostname: The instance host name. 2555 2556 :type os: string 2557 :param os: The instance's operating system, which must be set to one of 2558 the following. 2559 2560 + Standard operating systems: An Amazon Linux version such as `Amazon 2561 Linux 2014.09`, `Ubuntu 12.04 LTS`, or `Ubuntu 14.04 LTS`. 2562 + Custom AMIs: `Custom` 2563 2564 2565 The default option is the current Amazon Linux version, such as `Amazon 2566 Linux 2014.09`. If you set this parameter to `Custom`, you must use 2567 the CreateInstance action's AmiId parameter to specify the custom 2568 AMI that you want to use. For more information on the standard 2569 operating systems, see `Operating Systems`_For more information on 2570 how to use custom AMIs with OpsWorks, see `Using Custom AMIs`_. 2571 2572 :type ami_id: string 2573 :param ami_id: 2574 A custom AMI ID to be used to create the instance. The AMI should be 2575 based on one of the standard AWS OpsWorks AMIs: Amazon Linux, 2576 Ubuntu 12.04 LTS, or Ubuntu 14.04 LTS. For more information, see 2577 `Instances`_ 2578 2579 If you specify a custom AMI, you must set `Os` to `Custom`. 2580 2581 :type ssh_key_name: string 2582 :param ssh_key_name: The instance SSH key name. 2583 2584 :type architecture: string 2585 :param architecture: The instance architecture. Instance types do not 2586 necessarily support both architectures. For a list of the 2587 architectures that are supported by the different instance types, 2588 see `Instance Families and Types`_. 2589 2590 :type install_updates_on_boot: boolean 2591 :param install_updates_on_boot: 2592 Whether to install operating system and package updates when the 2593 instance boots. The default value is `True`. To control when 2594 updates are installed, set this value to `False`. You must then 2595 update your instances manually by using CreateDeployment to run the 2596 `update_dependencies` stack command or manually running `yum` 2597 (Amazon Linux) or `apt-get` (Ubuntu) on the instances. 2598 2599 2600 We strongly recommend using the default value of `True`, to ensure that 2601 your instances have the latest security updates. 2602 2603 :type ebs_optimized: boolean 2604 :param ebs_optimized: Whether this is an Amazon EBS-optimized instance. 2605 2606 """ 2607 params = {'InstanceId': instance_id, } 2608 if layer_ids is not None: 2609 params['LayerIds'] = layer_ids 2610 if instance_type is not None: 2611 params['InstanceType'] = instance_type 2612 if auto_scaling_type is not None: 2613 params['AutoScalingType'] = auto_scaling_type 2614 if hostname is not None: 2615 params['Hostname'] = hostname 2616 if os is not None: 2617 params['Os'] = os 2618 if ami_id is not None: 2619 params['AmiId'] = ami_id 2620 if ssh_key_name is not None: 2621 params['SshKeyName'] = ssh_key_name 2622 if architecture is not None: 2623 params['Architecture'] = architecture 2624 if install_updates_on_boot is not None: 2625 params['InstallUpdatesOnBoot'] = install_updates_on_boot 2626 if ebs_optimized is not None: 2627 params['EbsOptimized'] = ebs_optimized 2628 return self.make_request(action='UpdateInstance', 2629 body=json.dumps(params)) 2630 2631 def update_layer(self, layer_id, name=None, shortname=None, 2632 attributes=None, custom_instance_profile_arn=None, 2633 custom_security_group_ids=None, packages=None, 2634 volume_configurations=None, enable_auto_healing=None, 2635 auto_assign_elastic_ips=None, 2636 auto_assign_public_ips=None, custom_recipes=None, 2637 install_updates_on_boot=None, 2638 use_ebs_optimized_instances=None, 2639 lifecycle_event_configuration=None): 2640 """ 2641 Updates a specified layer. 2642 2643 **Required Permissions**: To use this action, an IAM user must 2644 have a Manage permissions level for the stack, or an attached 2645 policy that explicitly grants permissions. For more 2646 information on user permissions, see `Managing User 2647 Permissions`_. 2648 2649 :type layer_id: string 2650 :param layer_id: The layer ID. 2651 2652 :type name: string 2653 :param name: The layer name, which is used by the console. 2654 2655 :type shortname: string 2656 :param shortname: The layer short name, which is used internally by AWS 2657 OpsWorksand by Chef. The short name is also used as the name for 2658 the directory where your app files are installed. It can have a 2659 maximum of 200 characters and must be in the following format: 2660 /\A[a-z0-9\-\_\.]+\Z/. 2661 2662 :type attributes: map 2663 :param attributes: One or more user-defined key/value pairs to be added 2664 to the stack attributes. 2665 2666 :type custom_instance_profile_arn: string 2667 :param custom_instance_profile_arn: The ARN of an IAM profile to be 2668 used for all of the layer's EC2 instances. For more information 2669 about IAM ARNs, see `Using Identifiers`_. 2670 2671 :type custom_security_group_ids: list 2672 :param custom_security_group_ids: An array containing the layer's 2673 custom security group IDs. 2674 2675 :type packages: list 2676 :param packages: An array of `Package` objects that describe the 2677 layer's packages. 2678 2679 :type volume_configurations: list 2680 :param volume_configurations: A `VolumeConfigurations` object that 2681 describes the layer's Amazon EBS volumes. 2682 2683 :type enable_auto_healing: boolean 2684 :param enable_auto_healing: Whether to disable auto healing for the 2685 layer. 2686 2687 :type auto_assign_elastic_ips: boolean 2688 :param auto_assign_elastic_ips: Whether to automatically assign an 2689 `Elastic IP address`_ to the layer's instances. For more 2690 information, see `How to Edit a Layer`_. 2691 2692 :type auto_assign_public_ips: boolean 2693 :param auto_assign_public_ips: For stacks that are running in a VPC, 2694 whether to automatically assign a public IP address to the layer's 2695 instances. For more information, see `How to Edit a Layer`_. 2696 2697 :type custom_recipes: dict 2698 :param custom_recipes: A `LayerCustomRecipes` object that specifies the 2699 layer's custom recipes. 2700 2701 :type install_updates_on_boot: boolean 2702 :param install_updates_on_boot: 2703 Whether to install operating system and package updates when the 2704 instance boots. The default value is `True`. To control when 2705 updates are installed, set this value to `False`. You must then 2706 update your instances manually by using CreateDeployment to run the 2707 `update_dependencies` stack command or manually running `yum` 2708 (Amazon Linux) or `apt-get` (Ubuntu) on the instances. 2709 2710 2711 We strongly recommend using the default value of `True`, to ensure that 2712 your instances have the latest security updates. 2713 2714 :type use_ebs_optimized_instances: boolean 2715 :param use_ebs_optimized_instances: Whether to use Amazon EBS-optimized 2716 instances. 2717 2718 :type lifecycle_event_configuration: dict 2719 :param lifecycle_event_configuration: 2720 2721 """ 2722 params = {'LayerId': layer_id, } 2723 if name is not None: 2724 params['Name'] = name 2725 if shortname is not None: 2726 params['Shortname'] = shortname 2727 if attributes is not None: 2728 params['Attributes'] = attributes 2729 if custom_instance_profile_arn is not None: 2730 params['CustomInstanceProfileArn'] = custom_instance_profile_arn 2731 if custom_security_group_ids is not None: 2732 params['CustomSecurityGroupIds'] = custom_security_group_ids 2733 if packages is not None: 2734 params['Packages'] = packages 2735 if volume_configurations is not None: 2736 params['VolumeConfigurations'] = volume_configurations 2737 if enable_auto_healing is not None: 2738 params['EnableAutoHealing'] = enable_auto_healing 2739 if auto_assign_elastic_ips is not None: 2740 params['AutoAssignElasticIps'] = auto_assign_elastic_ips 2741 if auto_assign_public_ips is not None: 2742 params['AutoAssignPublicIps'] = auto_assign_public_ips 2743 if custom_recipes is not None: 2744 params['CustomRecipes'] = custom_recipes 2745 if install_updates_on_boot is not None: 2746 params['InstallUpdatesOnBoot'] = install_updates_on_boot 2747 if use_ebs_optimized_instances is not None: 2748 params['UseEbsOptimizedInstances'] = use_ebs_optimized_instances 2749 if lifecycle_event_configuration is not None: 2750 params['LifecycleEventConfiguration'] = lifecycle_event_configuration 2751 return self.make_request(action='UpdateLayer', 2752 body=json.dumps(params)) 2753 2754 def update_my_user_profile(self, ssh_public_key=None): 2755 """ 2756 Updates a user's SSH public key. 2757 2758 **Required Permissions**: To use this action, an IAM user must 2759 have self-management enabled or an attached policy that 2760 explicitly grants permissions. For more information on user 2761 permissions, see `Managing User Permissions`_. 2762 2763 :type ssh_public_key: string 2764 :param ssh_public_key: The user's SSH public key. 2765 2766 """ 2767 params = {} 2768 if ssh_public_key is not None: 2769 params['SshPublicKey'] = ssh_public_key 2770 return self.make_request(action='UpdateMyUserProfile', 2771 body=json.dumps(params)) 2772 2773 def update_rds_db_instance(self, rds_db_instance_arn, db_user=None, 2774 db_password=None): 2775 """ 2776 Updates an Amazon RDS instance. 2777 2778 **Required Permissions**: To use this action, an IAM user must 2779 have a Manage permissions level for the stack, or an attached 2780 policy that explicitly grants permissions. For more 2781 information on user permissions, see `Managing User 2782 Permissions`_. 2783 2784 :type rds_db_instance_arn: string 2785 :param rds_db_instance_arn: The Amazon RDS instance's ARN. 2786 2787 :type db_user: string 2788 :param db_user: The master user name. 2789 2790 :type db_password: string 2791 :param db_password: The database password. 2792 2793 """ 2794 params = {'RdsDbInstanceArn': rds_db_instance_arn, } 2795 if db_user is not None: 2796 params['DbUser'] = db_user 2797 if db_password is not None: 2798 params['DbPassword'] = db_password 2799 return self.make_request(action='UpdateRdsDbInstance', 2800 body=json.dumps(params)) 2801 2802 def update_stack(self, stack_id, name=None, attributes=None, 2803 service_role_arn=None, 2804 default_instance_profile_arn=None, default_os=None, 2805 hostname_theme=None, default_availability_zone=None, 2806 default_subnet_id=None, custom_json=None, 2807 configuration_manager=None, chef_configuration=None, 2808 use_custom_cookbooks=None, custom_cookbooks_source=None, 2809 default_ssh_key_name=None, 2810 default_root_device_type=None, 2811 use_opsworks_security_groups=None): 2812 """ 2813 Updates a specified stack. 2814 2815 **Required Permissions**: To use this action, an IAM user must 2816 have a Manage permissions level for the stack, or an attached 2817 policy that explicitly grants permissions. For more 2818 information on user permissions, see `Managing User 2819 Permissions`_. 2820 2821 :type stack_id: string 2822 :param stack_id: The stack ID. 2823 2824 :type name: string 2825 :param name: The stack's new name. 2826 2827 :type attributes: map 2828 :param attributes: One or more user-defined key/value pairs to be added 2829 to the stack attributes. 2830 2831 :type service_role_arn: string 2832 :param service_role_arn: 2833 The stack AWS Identity and Access Management (IAM) role, which allows 2834 AWS OpsWorks to work with AWS resources on your behalf. You must 2835 set this parameter to the Amazon Resource Name (ARN) for an 2836 existing IAM role. For more information about IAM ARNs, see `Using 2837 Identifiers`_. 2838 2839 2840 You must set this parameter to a valid service role ARN or the action 2841 will fail; there is no default value. You can specify the stack's 2842 current service role ARN, if you prefer, but you must do so 2843 explicitly. 2844 2845 :type default_instance_profile_arn: string 2846 :param default_instance_profile_arn: The ARN of an IAM profile that is 2847 the default profile for all of the stack's EC2 instances. For more 2848 information about IAM ARNs, see `Using Identifiers`_. 2849 2850 :type default_os: string 2851 :param default_os: The stack's operating system, which must be set to 2852 one of the following. 2853 2854 + Standard operating systems: an Amazon Linux version such as `Amazon 2855 Linux 2014.09`, `Ubuntu 12.04 LTS`, or `Ubuntu 14.04 LTS`. 2856 + Custom AMIs: `Custom`. You specify the custom AMI you want to use 2857 when you create instances. 2858 2859 2860 The default option is the current Amazon Linux version. 2861 2862 :type hostname_theme: string 2863 :param hostname_theme: The stack's new host name theme, with spaces are 2864 replaced by underscores. The theme is used to generate host names 2865 for the stack's instances. By default, `HostnameTheme` is set to 2866 `Layer_Dependent`, which creates host names by appending integers 2867 to the layer's short name. The other themes are: 2868 2869 + `Baked_Goods` 2870 + `Clouds` 2871 + `European_Cities` 2872 + `Fruits` 2873 + `Greek_Deities` 2874 + `Legendary_Creatures_from_Japan` 2875 + `Planets_and_Moons` 2876 + `Roman_Deities` 2877 + `Scottish_Islands` 2878 + `US_Cities` 2879 + `Wild_Cats` 2880 2881 2882 To obtain a generated host name, call `GetHostNameSuggestion`, which 2883 returns a host name based on the current theme. 2884 2885 :type default_availability_zone: string 2886 :param default_availability_zone: The stack's default Availability 2887 Zone, which must be in the specified region. For more information, 2888 see `Regions and Endpoints`_. If you also specify a value for 2889 `DefaultSubnetId`, the subnet must be in the same zone. For more 2890 information, see CreateStack. 2891 2892 :type default_subnet_id: string 2893 :param default_subnet_id: The stack's default VPC subnet ID. This 2894 parameter is required if you specify a value for the `VpcId` 2895 parameter. All instances are launched into this subnet unless you 2896 specify otherwise when you create the instance. If you also specify 2897 a value for `DefaultAvailabilityZone`, the subnet must be in that 2898 zone. For information on default values and when this parameter is 2899 required, see the `VpcId` parameter description. 2900 2901 :type custom_json: string 2902 :param custom_json: A string that contains user-defined, custom JSON. 2903 It is used to override the corresponding default stack 2904 configuration JSON values. The string should be in the following 2905 format and must escape characters such as '"'.: 2906 `"{\"key1\": \"value1\", \"key2\": \"value2\",...}"` 2907 2908 For more information on custom JSON, see `Use Custom JSON to Modify the 2909 Stack Configuration JSON`_. 2910 2911 :type configuration_manager: dict 2912 :param configuration_manager: The configuration manager. When you clone 2913 a stack we recommend that you use the configuration manager to 2914 specify the Chef version, 0.9, 11.4, or 11.10. The default value is 2915 currently 11.4. 2916 2917 :type chef_configuration: dict 2918 :param chef_configuration: A `ChefConfiguration` object that specifies 2919 whether to enable Berkshelf and the Berkshelf version on Chef 11.10 2920 stacks. For more information, see `Create a New Stack`_. 2921 2922 :type use_custom_cookbooks: boolean 2923 :param use_custom_cookbooks: Whether the stack uses custom cookbooks. 2924 2925 :type custom_cookbooks_source: dict 2926 :param custom_cookbooks_source: Contains the information required to 2927 retrieve an app or cookbook from a repository. For more 2928 information, see `Creating Apps`_ or `Custom Recipes and 2929 Cookbooks`_. 2930 2931 :type default_ssh_key_name: string 2932 :param default_ssh_key_name: A default SSH key for the stack instances. 2933 You can override this value when you create or update an instance. 2934 2935 :type default_root_device_type: string 2936 :param default_root_device_type: The default root device type. This 2937 value is used by default for all instances in the stack, but you 2938 can override it when you create an instance. For more information, 2939 see `Storage for the Root Device`_. 2940 2941 :type use_opsworks_security_groups: boolean 2942 :param use_opsworks_security_groups: Whether to associate the AWS 2943 OpsWorks built-in security groups with the stack's layers. 2944 AWS OpsWorks provides a standard set of built-in security groups, one 2945 for each layer, which are associated with layers by default. 2946 `UseOpsworksSecurityGroups` allows you to instead provide your own 2947 custom security groups. `UseOpsworksSecurityGroups` has the 2948 following settings: 2949 2950 2951 + True - AWS OpsWorks automatically associates the appropriate built-in 2952 security group with each layer (default setting). You can associate 2953 additional security groups with a layer after you create it but you 2954 cannot delete the built-in security group. 2955 + False - AWS OpsWorks does not associate built-in security groups with 2956 layers. You must create appropriate EC2 security groups and 2957 associate a security group with each layer that you create. 2958 However, you can still manually associate a built-in security group 2959 with a layer on creation; custom security groups are required only 2960 for those layers that need custom settings. 2961 2962 2963 For more information, see `Create a New Stack`_. 2964 2965 """ 2966 params = {'StackId': stack_id, } 2967 if name is not None: 2968 params['Name'] = name 2969 if attributes is not None: 2970 params['Attributes'] = attributes 2971 if service_role_arn is not None: 2972 params['ServiceRoleArn'] = service_role_arn 2973 if default_instance_profile_arn is not None: 2974 params['DefaultInstanceProfileArn'] = default_instance_profile_arn 2975 if default_os is not None: 2976 params['DefaultOs'] = default_os 2977 if hostname_theme is not None: 2978 params['HostnameTheme'] = hostname_theme 2979 if default_availability_zone is not None: 2980 params['DefaultAvailabilityZone'] = default_availability_zone 2981 if default_subnet_id is not None: 2982 params['DefaultSubnetId'] = default_subnet_id 2983 if custom_json is not None: 2984 params['CustomJson'] = custom_json 2985 if configuration_manager is not None: 2986 params['ConfigurationManager'] = configuration_manager 2987 if chef_configuration is not None: 2988 params['ChefConfiguration'] = chef_configuration 2989 if use_custom_cookbooks is not None: 2990 params['UseCustomCookbooks'] = use_custom_cookbooks 2991 if custom_cookbooks_source is not None: 2992 params['CustomCookbooksSource'] = custom_cookbooks_source 2993 if default_ssh_key_name is not None: 2994 params['DefaultSshKeyName'] = default_ssh_key_name 2995 if default_root_device_type is not None: 2996 params['DefaultRootDeviceType'] = default_root_device_type 2997 if use_opsworks_security_groups is not None: 2998 params['UseOpsworksSecurityGroups'] = use_opsworks_security_groups 2999 return self.make_request(action='UpdateStack', 3000 body=json.dumps(params)) 3001 3002 def update_user_profile(self, iam_user_arn, ssh_username=None, 3003 ssh_public_key=None, allow_self_management=None): 3004 """ 3005 Updates a specified user profile. 3006 3007 **Required Permissions**: To use this action, an IAM user must 3008 have an attached policy that explicitly grants permissions. 3009 For more information on user permissions, see `Managing User 3010 Permissions`_. 3011 3012 :type iam_user_arn: string 3013 :param iam_user_arn: The user IAM ARN. 3014 3015 :type ssh_username: string 3016 :param ssh_username: The user's SSH user name. The allowable characters 3017 are [a-z], [A-Z], [0-9], '-', and '_'. If the specified name 3018 includes other punctuation marks, AWS OpsWorks removes them. For 3019 example, `my.name` will be changed to `myname`. If you do not 3020 specify an SSH user name, AWS OpsWorks generates one from the IAM 3021 user name. 3022 3023 :type ssh_public_key: string 3024 :param ssh_public_key: The user's new SSH public key. 3025 3026 :type allow_self_management: boolean 3027 :param allow_self_management: Whether users can specify their own SSH 3028 public key through the My Settings page. For more information, see 3029 `Managing User Permissions`_. 3030 3031 """ 3032 params = {'IamUserArn': iam_user_arn, } 3033 if ssh_username is not None: 3034 params['SshUsername'] = ssh_username 3035 if ssh_public_key is not None: 3036 params['SshPublicKey'] = ssh_public_key 3037 if allow_self_management is not None: 3038 params['AllowSelfManagement'] = allow_self_management 3039 return self.make_request(action='UpdateUserProfile', 3040 body=json.dumps(params)) 3041 3042 def update_volume(self, volume_id, name=None, mount_point=None): 3043 """ 3044 Updates an Amazon EBS volume's name or mount point. For more 3045 information, see `Resource Management`_. 3046 3047 **Required Permissions**: To use this action, an IAM user must 3048 have a Manage permissions level for the stack, or an attached 3049 policy that explicitly grants permissions. For more 3050 information on user permissions, see `Managing User 3051 Permissions`_. 3052 3053 :type volume_id: string 3054 :param volume_id: The volume ID. 3055 3056 :type name: string 3057 :param name: The new name. 3058 3059 :type mount_point: string 3060 :param mount_point: The new mount point. 3061 3062 """ 3063 params = {'VolumeId': volume_id, } 3064 if name is not None: 3065 params['Name'] = name 3066 if mount_point is not None: 3067 params['MountPoint'] = mount_point 3068 return self.make_request(action='UpdateVolume', 3069 body=json.dumps(params)) 3070 3071 def make_request(self, action, body): 3072 headers = { 3073 'X-Amz-Target': '%s.%s' % (self.TargetPrefix, action), 3074 'Host': self.region.endpoint, 3075 'Content-Type': 'application/x-amz-json-1.1', 3076 'Content-Length': str(len(body)), 3077 } 3078 http_request = self.build_base_http_request( 3079 method='POST', path='/', auth_path='/', params={}, 3080 headers=headers, data=body) 3081 response = self._mexe(http_request, sender=None, 3082 override_num_retries=10) 3083 response_body = response.read().decode('utf-8') 3084 boto.log.debug(response_body) 3085 if response.status == 200: 3086 if response_body: 3087 return json.loads(response_body) 3088 else: 3089 json_body = json.loads(response_body) 3090 fault_name = json_body.get('__type', None) 3091 exception_class = self._faults.get(fault_name, self.ResponseError) 3092 raise exception_class(response.status, response.reason, 3093 body=json_body) 3094 3095