diff options
author | Daniel G. Taylor <danielgtaylor@gmail.com> | 2014-08-21 16:31:25 -0700 |
---|---|---|
committer | Daniel G. Taylor <danielgtaylor@gmail.com> | 2014-08-21 16:31:25 -0700 |
commit | 69b6f4433ea07eb0414da328460760024ca6d8a3 (patch) | |
tree | 0f78a1f9cc4c8d98e1bedac2d73e2497ab5794b1 | |
parent | 38478c1e71b2c307cdfff13ff0191dfa55006139 (diff) | |
download | boto-69b6f4433ea07eb0414da328460760024ca6d8a3.tar.gz |
Update to latest OpsWorks API
This updates documentation and adds a handful of new parameters and a couple
of new service calls to the low level OpsWorks client. Existing tests continue
to pass.
-rw-r--r-- | boto/opsworks/layer1.py | 522 |
1 files changed, 364 insertions, 158 deletions
diff --git a/boto/opsworks/layer1.py b/boto/opsworks/layer1.py index 3b703ee1..6610f32a 100644 --- a/boto/opsworks/layer1.py +++ b/boto/opsworks/layer1.py @@ -1,4 +1,4 @@ -# Copyright (c) 2013 Amazon.com, Inc. or its affiliates. All Rights Reserved +# Copyright (c) 2014 Amazon.com, Inc. or its affiliates. All Rights Reserved # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the @@ -20,13 +20,12 @@ # IN THE SOFTWARE. # - import boto +from boto.compat import json from boto.connection import AWSQueryConnection from boto.regioninfo import RegionInfo from boto.exception import JSONResponseError from boto.opsworks import exceptions -from boto.compat import json class OpsWorksConnection(AWSQueryConnection): @@ -70,9 +69,8 @@ class OpsWorksConnection(AWSQueryConnection): When you call CreateStack, CloneStack, or UpdateStack we recommend you use the `ConfigurationManager` parameter to specify the Chef - version, 0.9 or 11.4. The default value is currently 0.9. However, - we expect to change the default value to 11.4 in October 2013. For - more information, see `Using AWS OpsWorks with Chef 11`_. + version, 0.9, 11.4, or 11.10. The default value is currently 11.4. + For more information, see `Chef Versions`_. """ APIVersion = "2013-02-18" DefaultRegionName = "us-east-1" @@ -92,7 +90,10 @@ class OpsWorksConnection(AWSQueryConnection): if not region: region = RegionInfo(self, self.DefaultRegionName, self.DefaultRegionEndpoint) - kwargs['host'] = region.endpoint + + if 'host' not in kwargs or kwargs['host'] is None: + kwargs['host'] = region.endpoint + super(OpsWorksConnection, self).__init__(**kwargs) self.region = region @@ -155,12 +156,8 @@ class OpsWorksConnection(AWSQueryConnection): layer_id): """ Attaches an Elastic Load Balancing load balancer to a - specified layer. - - You must create the Elastic Load Balancing instance - separately, by using the Elastic Load Balancing console, API, - or CLI. For more information, see ` Elastic Load Balancing - Developer Guide`_. + specified layer. For more information, see `Elastic Load + Balancing`_. **Required Permissions**: To use this action, an IAM user must have a Manage permissions level for the stack, or an attached @@ -189,7 +186,9 @@ class OpsWorksConnection(AWSQueryConnection): default_instance_profile_arn=None, default_os=None, hostname_theme=None, default_availability_zone=None, default_subnet_id=None, custom_json=None, - configuration_manager=None, use_custom_cookbooks=None, + configuration_manager=None, chef_configuration=None, + use_custom_cookbooks=None, + use_opsworks_security_groups=None, custom_cookbooks_source=None, default_ssh_key_name=None, clone_permissions=None, clone_app_ids=None, default_root_device_type=None): @@ -247,19 +246,14 @@ class OpsWorksConnection(AWSQueryConnection): pairs to be added to the cloned stack. :type service_role_arn: string - :param service_role_arn: - The stack AWS Identity and Access Management (IAM) role, which allows - AWS OpsWorks to work with AWS resources on your behalf. You must - set this parameter to the Amazon Resource Name (ARN) for an - existing IAM role. If you create a stack by using the AWS OpsWorks - console, it creates the role for you. You can obtain an existing - stack's IAM ARN programmatically by calling DescribePermissions. - For more information about IAM ARNs, see `Using Identifiers`_. - - You must set this parameter to a valid service role ARN or the action - will fail; there is no default value. You can specify the source - stack's service role ARN, if you prefer, but you must do so - explicitly. + :param service_role_arn: The stack AWS Identity and Access Management + (IAM) role, which allows AWS OpsWorks to work with AWS resources on + your behalf. You must set this parameter to the Amazon Resource + Name (ARN) for an existing IAM role. If you create a stack by using + the AWS OpsWorks console, it creates the role for you. You can + obtain an existing stack's IAM ARN programmatically by calling + DescribePermissions. For more information about IAM ARNs, see + `Using Identifiers`_. :type default_instance_profile_arn: string :param default_instance_profile_arn: The ARN of an IAM profile that is @@ -313,21 +307,50 @@ class OpsWorksConnection(AWSQueryConnection): :param custom_json: A string that contains user-defined, custom JSON. It is used to override the corresponding default stack configuration JSON values. The string should be in the following - format and must escape characters such as '"'.: `"{\"key1\": - \"value1\", \"key2\": \"value2\",...}"` + format and must escape characters such as '"'.: + `"{\"key1\": \"value1\", \"key2\": \"value2\",...}"` + For more information on custom JSON, see `Use Custom JSON to Modify the Stack Configuration JSON`_ :type configuration_manager: dict :param configuration_manager: The configuration manager. When you clone a stack we recommend that you use the configuration manager to - specify the Chef version, 0.9 or 11.4. The default value is - currently 0.9. However, we expect to change the default value to - 11.4 in September 2013. + specify the Chef version, 0.9, 11.4, or 11.10. The default value is + currently 11.4. + + :type chef_configuration: dict + :param chef_configuration: A `ChefConfiguration` object that specifies + whether to enable Berkshelf and the Berkshelf version on Chef 11.10 + stacks. For more information, see `Create a New Stack`_. :type use_custom_cookbooks: boolean :param use_custom_cookbooks: Whether to use custom cookbooks. + :type use_opsworks_security_groups: boolean + :param use_opsworks_security_groups: Whether to associate the AWS + OpsWorks built-in security groups with the stack's layers. + AWS OpsWorks provides a standard set of built-in security groups, one + for each layer, which are associated with layers by default. With + `UseOpsworksSecurityGroups` you can instead provide your own custom + security groups. `UseOpsworksSecurityGroups` has the following + settings: + + + + True - AWS OpsWorks automatically associates the appropriate built-in + security group with each layer (default setting). You can associate + additional security groups with a layer after you create it but you + cannot delete the built-in security group. + + False - AWS OpsWorks does not associate built-in security groups with + layers. You must create appropriate EC2 security groups and + associate a security group with each layer that you create. + However, you can still manually associate a built-in security group + with a layer on creation; custom security groups are required only + for those layers that need custom settings. + + + For more information, see `Create a New Stack`_. + :type custom_cookbooks_source: dict :param custom_cookbooks_source: Contains the information required to retrieve an app or cookbook from a repository. For more @@ -379,8 +402,12 @@ class OpsWorksConnection(AWSQueryConnection): params['CustomJson'] = custom_json if configuration_manager is not None: params['ConfigurationManager'] = configuration_manager + if chef_configuration is not None: + params['ChefConfiguration'] = chef_configuration if use_custom_cookbooks is not None: params['UseCustomCookbooks'] = use_custom_cookbooks + if use_opsworks_security_groups is not None: + params['UseOpsworksSecurityGroups'] = use_opsworks_security_groups if custom_cookbooks_source is not None: params['CustomCookbooksSource'] = custom_cookbooks_source if default_ssh_key_name is not None: @@ -395,8 +422,9 @@ class OpsWorksConnection(AWSQueryConnection): body=json.dumps(params)) def create_app(self, stack_id, name, type, shortname=None, - description=None, app_source=None, domains=None, - enable_ssl=None, ssl_configuration=None, attributes=None): + description=None, data_sources=None, app_source=None, + domains=None, enable_ssl=None, ssl_configuration=None, + attributes=None): """ Creates an app for a specified stack. For more information, see `Creating Apps`_. @@ -419,6 +447,9 @@ class OpsWorksConnection(AWSQueryConnection): :type description: string :param description: A description of the app. + :type data_sources: list + :param data_sources: The app's data source. + :type type: string :param type: The app type. Each supported type is associated with a particular layer. For example, PHP applications are associated with @@ -441,7 +472,7 @@ class OpsWorksConnection(AWSQueryConnection): :type attributes: map :param attributes: One or more user-defined key/value pairs to be added - to the stack attributes bag. + to the stack attributes. """ params = {'StackId': stack_id, 'Name': name, 'Type': type, } @@ -449,6 +480,8 @@ class OpsWorksConnection(AWSQueryConnection): params['Shortname'] = shortname if description is not None: params['Description'] = description + if data_sources is not None: + params['DataSources'] = data_sources if app_source is not None: params['AppSource'] = app_source if domains is not None: @@ -505,8 +538,9 @@ class OpsWorksConnection(AWSQueryConnection): :param custom_json: A string that contains user-defined, custom JSON. It is used to override the corresponding default stack configuration JSON values. The string should be in the following - format and must escape characters such as '"'.: `"{\"key1\": - \"value1\", \"key2\": \"value2\",...}"` + format and must escape characters such as '"'.: + `"{\"key1\": \"value1\", \"key2\": \"value2\",...}"` + For more information on custom JSON, see `Use Custom JSON to Modify the Stack Configuration JSON`_. @@ -526,9 +560,10 @@ class OpsWorksConnection(AWSQueryConnection): def create_instance(self, stack_id, layer_ids, instance_type, auto_scaling_type=None, hostname=None, os=None, ami_id=None, ssh_key_name=None, - availability_zone=None, subnet_id=None, - architecture=None, root_device_type=None, - install_updates_on_boot=None): + availability_zone=None, virtualization_type=None, + subnet_id=None, architecture=None, + root_device_type=None, install_updates_on_boot=None, + ebs_optimized=None): """ Creates an instance in a specified stack. For more information, see `Adding an Instance to a Layer`_. @@ -598,6 +633,10 @@ class OpsWorksConnection(AWSQueryConnection): :param availability_zone: The instance Availability Zone. For more information, see `Regions and Endpoints`_. + :type virtualization_type: string + :param virtualization_type: The instance's virtualization type, + `paravirtual` or `hvm`. + :type subnet_id: string :param subnet_id: The ID of the instance's subnet. If the stack is running in a VPC, you can use this parameter to override the @@ -605,26 +644,28 @@ class OpsWorksConnection(AWSQueryConnection): the instance in a different subnet. :type architecture: string - :param architecture: The instance architecture. Instance types do not - necessarily support both architectures. For a list of the - architectures that are supported by the different instance types, - see `Instance Families and Types`_. + :param architecture: The instance architecture. The default option is + `x86_64`. Instance types do not necessarily support both + architectures. For a list of the architectures that are supported + by the different instance types, see `Instance Families and + Types`_. :type root_device_type: string :param root_device_type: The instance root device type. For more information, see `Storage for the Root Device`_. :type install_updates_on_boot: boolean - :param install_updates_on_boot: - Whether to install operating system and package updates when the - instance boots. The default value is `True`. To control when - updates are installed, set this value to `False`. You must then - update your instances manually by using CreateDeployment to run the - `update_dependencies` stack command or manually running `yum` - (Amazon Linux) or `apt-get` (Ubuntu) on the instances. + :param install_updates_on_boot: Whether to install operating system and + package updates when the instance boots. The default value is + `True`. To control when updates are installed, set this value to + `False`. You must then update your instances manually by using + CreateDeployment to run the `update_dependencies` stack command or + manually running `yum` (Amazon Linux) or `apt-get` (Ubuntu) on the + instances. - We strongly recommend using the default value of `True`, to ensure that - your instances have the latest security updates. + :type ebs_optimized: boolean + :param ebs_optimized: Whether to create an Amazon EBS-optimized + instance. """ params = { @@ -644,6 +685,8 @@ class OpsWorksConnection(AWSQueryConnection): params['SshKeyName'] = ssh_key_name if availability_zone is not None: params['AvailabilityZone'] = availability_zone + if virtualization_type is not None: + params['VirtualizationType'] = virtualization_type if subnet_id is not None: params['SubnetId'] = subnet_id if architecture is not None: @@ -652,6 +695,8 @@ class OpsWorksConnection(AWSQueryConnection): params['RootDeviceType'] = root_device_type if install_updates_on_boot is not None: params['InstallUpdatesOnBoot'] = install_updates_on_boot + if ebs_optimized is not None: + params['EbsOptimized'] = ebs_optimized return self.make_request(action='CreateInstance', body=json.dumps(params)) @@ -661,19 +706,12 @@ class OpsWorksConnection(AWSQueryConnection): volume_configurations=None, enable_auto_healing=None, auto_assign_elastic_ips=None, auto_assign_public_ips=None, custom_recipes=None, - install_updates_on_boot=None): + install_updates_on_boot=None, + use_ebs_optimized_instances=None): """ Creates a layer. For more information, see `How to Create a Layer`_. - You should use **CreateLayer** for noncustom layer types such - as PHP App Server only if the stack does not have an existing - layer of that type. A stack can have at most one instance of - each noncustom layer; if you attempt to create a second - instance, **CreateLayer** fails. A stack can have an arbitrary - number of custom layers, so you can call **CreateLayer** as - many times as you like for that layer type. - **Required Permissions**: To use this action, an IAM user must have a Manage permissions level for the stack, or an attached policy that explicitly grants permissions. For more @@ -685,19 +723,21 @@ class OpsWorksConnection(AWSQueryConnection): :type type: string :param type: - The layer type. A stack cannot have more than one layer of the same - type. This parameter must be set to one of the following: + The layer type. A stack cannot have more than one built-in layer of the + same type. It can have any number of custom layers. This parameter + must be set to one of the following: - + lb: An HAProxy layer - + web: A Static Web Server layer + + custom: A custom layer + + db-master: A MySQL layer + + java-app: A Java App Server layer + rails-app: A Rails App Server layer - + php-app: A PHP App Server layer - + nodejs-app: A Node.js App Server layer + + lb: An HAProxy layer + memcached: A Memcached layer - + db-master: A MySQL layer + monitoring-master: A Ganglia layer - + custom: A custom layer + + nodejs-app: A Node.js App Server layer + + php-app: A PHP App Server layer + + web: A Static Web Server layer :type name: string :param name: The layer name, which is used by the console. @@ -711,7 +751,7 @@ class OpsWorksConnection(AWSQueryConnection): :type attributes: map :param attributes: One or more user-defined key/value pairs to be added - to the stack attributes bag. + to the stack attributes. :type custom_instance_profile_arn: string :param custom_instance_profile_arn: The ARN of an IAM profile that to @@ -728,7 +768,7 @@ class OpsWorksConnection(AWSQueryConnection): :type volume_configurations: list :param volume_configurations: A `VolumeConfigurations` object that - describes the layer Amazon EBS volumes. + describes the layer's Amazon EBS volumes. :type enable_auto_healing: boolean :param enable_auto_healing: Whether to disable auto healing for the @@ -749,16 +789,17 @@ class OpsWorksConnection(AWSQueryConnection): layer custom recipes. :type install_updates_on_boot: boolean - :param install_updates_on_boot: - Whether to install operating system and package updates when the - instance boots. The default value is `True`. To control when - updates are installed, set this value to `False`. You must then - update your instances manually by using CreateDeployment to run the - `update_dependencies` stack command or manually running `yum` - (Amazon Linux) or `apt-get` (Ubuntu) on the instances. + :param install_updates_on_boot: Whether to install operating system and + package updates when the instance boots. The default value is + `True`. To control when updates are installed, set this value to + `False`. You must then update your instances manually by using + CreateDeployment to run the `update_dependencies` stack command or + manually running `yum` (Amazon Linux) or `apt-get` (Ubuntu) on the + instances. - We strongly recommend using the default value of `True`, to ensure that - your instances have the latest security updates. + :type use_ebs_optimized_instances: boolean + :param use_ebs_optimized_instances: Whether to use Amazon EBS-optimized + instances. """ params = { @@ -787,6 +828,8 @@ class OpsWorksConnection(AWSQueryConnection): params['CustomRecipes'] = custom_recipes if install_updates_on_boot is not None: params['InstallUpdatesOnBoot'] = install_updates_on_boot + if use_ebs_optimized_instances is not None: + params['UseEbsOptimizedInstances'] = use_ebs_optimized_instances return self.make_request(action='CreateLayer', body=json.dumps(params)) @@ -795,8 +838,9 @@ class OpsWorksConnection(AWSQueryConnection): attributes=None, default_os=None, hostname_theme=None, default_availability_zone=None, default_subnet_id=None, custom_json=None, configuration_manager=None, - use_custom_cookbooks=None, custom_cookbooks_source=None, - default_ssh_key_name=None, + chef_configuration=None, use_custom_cookbooks=None, + use_opsworks_security_groups=None, + custom_cookbooks_source=None, default_ssh_key_name=None, default_root_device_type=None): """ Creates a new stack. For more information, see `Create a New @@ -846,7 +890,7 @@ class OpsWorksConnection(AWSQueryConnection): :type attributes: map :param attributes: One or more user-defined key/value pairs to be added - to the stack attributes bag. + to the stack attributes. :type service_role_arn: string :param service_role_arn: The stack AWS Identity and Access Management @@ -907,21 +951,50 @@ class OpsWorksConnection(AWSQueryConnection): :param custom_json: A string that contains user-defined, custom JSON. It is used to override the corresponding default stack configuration JSON values. The string should be in the following - format and must escape characters such as '"'.: `"{\"key1\": - \"value1\", \"key2\": \"value2\",...}"` + format and must escape characters such as '"'.: + `"{\"key1\": \"value1\", \"key2\": \"value2\",...}"` + For more information on custom JSON, see `Use Custom JSON to Modify the Stack Configuration JSON`_. :type configuration_manager: dict - :param configuration_manager: The configuration manager. When you - create a stack we recommend that you use the configuration manager - to specify the Chef version, 0.9 or 11.4. The default value is - currently 0.9. However, we expect to change the default value to - 11.4 in September 2013. + :param configuration_manager: The configuration manager. When you clone + a stack we recommend that you use the configuration manager to + specify the Chef version, 0.9, 11.4, or 11.10. The default value is + currently 11.4. + + :type chef_configuration: dict + :param chef_configuration: A `ChefConfiguration` object that specifies + whether to enable Berkshelf and the Berkshelf version on Chef 11.10 + stacks. For more information, see `Create a New Stack`_. :type use_custom_cookbooks: boolean :param use_custom_cookbooks: Whether the stack uses custom cookbooks. + :type use_opsworks_security_groups: boolean + :param use_opsworks_security_groups: Whether to associate the AWS + OpsWorks built-in security groups with the stack's layers. + AWS OpsWorks provides a standard set of built-in security groups, one + for each layer, which are associated with layers by default. With + `UseOpsworksSecurityGroups` you can instead provide your own custom + security groups. `UseOpsworksSecurityGroups` has the following + settings: + + + + True - AWS OpsWorks automatically associates the appropriate built-in + security group with each layer (default setting). You can associate + additional security groups with a layer after you create it but you + cannot delete the built-in security group. + + False - AWS OpsWorks does not associate built-in security groups with + layers. You must create appropriate EC2 security groups and + associate a security group with each layer that you create. + However, you can still manually associate a built-in security group + with a layer on creation; custom security groups are required only + for those layers that need custom settings. + + + For more information, see `Create a New Stack`_. + :type custom_cookbooks_source: dict :param custom_cookbooks_source: Contains the information required to retrieve an app or cookbook from a repository. For more @@ -934,9 +1007,10 @@ class OpsWorksConnection(AWSQueryConnection): :type default_root_device_type: string :param default_root_device_type: The default root device type. This - value is used by default for all instances in the cloned stack, but - you can override it when you create an instance. For more - information, see `Storage for the Root Device`_. + value is used by default for all instances in the stack, but you + can override it when you create an instance. The default option is + `instance-store`. For more information, see `Storage for the Root + Device`_. """ params = { @@ -961,8 +1035,12 @@ class OpsWorksConnection(AWSQueryConnection): params['CustomJson'] = custom_json if configuration_manager is not None: params['ConfigurationManager'] = configuration_manager + if chef_configuration is not None: + params['ChefConfiguration'] = chef_configuration if use_custom_cookbooks is not None: params['UseCustomCookbooks'] = use_custom_cookbooks + if use_opsworks_security_groups is not None: + params['UseOpsworksSecurityGroups'] = use_opsworks_security_groups if custom_cookbooks_source is not None: params['CustomCookbooksSource'] = custom_cookbooks_source if default_ssh_key_name is not None: @@ -986,7 +1064,12 @@ class OpsWorksConnection(AWSQueryConnection): :param iam_user_arn: The user's IAM ARN. :type ssh_username: string - :param ssh_username: The user's SSH user name. + :param ssh_username: The user's SSH user name. The allowable characters + are [a-z], [A-Z], [0-9], '-', and '_'. If the specified name + includes other punctuation marks, AWS OpsWorks removes them. For + example, `my.name` will be changed to `myname`. If you do not + specify an SSH user name, AWS OpsWorks generates one from the IAM + user name. :type ssh_public_key: string :param ssh_public_key: The user's public SSH key. @@ -994,7 +1077,7 @@ class OpsWorksConnection(AWSQueryConnection): :type allow_self_management: boolean :param allow_self_management: Whether users can specify their own SSH public key through the My Settings page. For more information, see - ``_. + `Setting an IAM User's Public SSH Key`_. """ params = {'IamUserArn': iam_user_arn, } @@ -1046,7 +1129,7 @@ class OpsWorksConnection(AWSQueryConnection): address. :type delete_volumes: boolean - :param delete_volumes: Whether to delete the instance Amazon EBS + :param delete_volumes: Whether to delete the instance's Amazon EBS volumes. """ @@ -1135,6 +1218,18 @@ class OpsWorksConnection(AWSQueryConnection): return self.make_request(action='DeregisterElasticIp', body=json.dumps(params)) + def deregister_rds_db_instance(self, rds_db_instance_arn): + """ + Deregisters an Amazon RDS instance. + + :type rds_db_instance_arn: string + :param rds_db_instance_arn: The Amazon RDS instance's ARN. + + """ + params = {'RdsDbInstanceArn': rds_db_instance_arn, } + return self.make_request(action='DeregisterRdsDbInstance', + body=json.dumps(params)) + def deregister_volume(self, volume_id): """ Deregisters an Amazon EBS volume. The volume can then be @@ -1434,7 +1529,7 @@ class OpsWorksConnection(AWSQueryConnection): explicitly grants permissions. For more information on user permissions, see `Managing User Permissions`_. - + """ params = {} return self.make_request(action='DescribeMyUserProfile', @@ -1444,6 +1539,8 @@ class OpsWorksConnection(AWSQueryConnection): """ Describes the permissions for a specified stack. + You must specify at least one of the parameters. + **Required Permissions**: To use this action, an IAM user must have a Manage permissions level for the stack, or an attached policy that explicitly grants permissions. For more @@ -1498,6 +1595,26 @@ class OpsWorksConnection(AWSQueryConnection): return self.make_request(action='DescribeRaidArrays', body=json.dumps(params)) + def describe_rds_db_instances(self, stack_id, rds_db_instance_arns=None): + """ + Describes Amazon RDS instances. + + :type stack_id: string + :param stack_id: The stack ID that the instances are registered with. + The operation returns descriptions of all registered Amazon RDS + instances. + + :type rds_db_instance_arns: list + :param rds_db_instance_arns: An array containing the ARNs of the + instances to be described. + + """ + params = {'StackId': stack_id, } + if rds_db_instance_arns is not None: + params['RdsDbInstanceArns'] = rds_db_instance_arns + return self.make_request(action='DescribeRdsDbInstances', + body=json.dumps(params)) + def describe_service_errors(self, stack_id=None, instance_id=None, service_error_ids=None): """ @@ -1583,8 +1700,6 @@ class OpsWorksConnection(AWSQueryConnection): Describes time-based auto scaling configurations for specified instances. - You must specify at least one of the parameters. - **Required Permissions**: To use this action, an IAM user must have a Show, Deploy, or Manage permissions level for the stack, or an attached policy that explicitly grants @@ -1775,6 +1890,33 @@ class OpsWorksConnection(AWSQueryConnection): return self.make_request(action='RegisterElasticIp', body=json.dumps(params)) + def register_rds_db_instance(self, stack_id, rds_db_instance_arn, + db_user, db_password): + """ + Registers an Amazon RDS instance with a stack. + + :type stack_id: string + :param stack_id: The stack ID. + + :type rds_db_instance_arn: string + :param rds_db_instance_arn: The Amazon RDS instance's ARN. + + :type db_user: string + :param db_user: The database's master user name. + + :type db_password: string + :param db_password: The database password. + + """ + params = { + 'StackId': stack_id, + 'RdsDbInstanceArn': rds_db_instance_arn, + 'DbUser': db_user, + 'DbPassword': db_password, + } + return self.make_request(action='RegisterRdsDbInstance', + body=json.dumps(params)) + def register_volume(self, stack_id, ec_2_volume_id=None): """ Registers an Amazon EBS volume with a specified stack. A @@ -1809,12 +1951,6 @@ class OpsWorksConnection(AWSQueryConnection): specified layer. For more information, see `Managing Load with Time-based and Load-based Instances`_. - To use load-based auto scaling, you must create a set of load- - based auto scaling instances. Load-based auto scaling operates - only on the instances from that set, so you must ensure that - you have created enough instances to handle the maximum - anticipated load. - **Required Permissions**: To use this action, an IAM user must have a Manage permissions level for the stack, or an attached policy that explicitly grants permissions. For more @@ -1853,7 +1989,7 @@ class OpsWorksConnection(AWSQueryConnection): def set_permission(self, stack_id, iam_user_arn, allow_ssh=None, allow_sudo=None, level=None): """ - Specifies a stack's permissions. For more information, see + Specifies a user's permissions. For more information, see `Security and Permissions`_. **Required Permissions**: To use this action, an IAM user must @@ -1949,7 +2085,7 @@ class OpsWorksConnection(AWSQueryConnection): def start_stack(self, stack_id): """ - Starts stack's instances. + Starts a stack's instances. **Required Permissions**: To use this action, an IAM user must have a Manage permissions level for the stack, or an attached @@ -2025,9 +2161,10 @@ class OpsWorksConnection(AWSQueryConnection): return self.make_request(action='UnassignVolume', body=json.dumps(params)) - def update_app(self, app_id, name=None, description=None, type=None, - app_source=None, domains=None, enable_ssl=None, - ssl_configuration=None, attributes=None): + def update_app(self, app_id, name=None, description=None, + data_sources=None, type=None, app_source=None, + domains=None, enable_ssl=None, ssl_configuration=None, + attributes=None): """ Updates a specified app. @@ -2046,6 +2183,9 @@ class OpsWorksConnection(AWSQueryConnection): :type description: string :param description: A description of the app. + :type data_sources: list + :param data_sources: The app's data sources. + :type type: string :param type: The app type. @@ -2065,7 +2205,7 @@ class OpsWorksConnection(AWSQueryConnection): :type attributes: map :param attributes: One or more user-defined key/value pairs to be added - to the stack attributes bag. + to the stack attributes. """ params = {'AppId': app_id, } @@ -2073,6 +2213,8 @@ class OpsWorksConnection(AWSQueryConnection): params['Name'] = name if description is not None: params['Description'] = description + if data_sources is not None: + params['DataSources'] = data_sources if type is not None: params['Type'] = type if app_source is not None: @@ -2116,7 +2258,7 @@ class OpsWorksConnection(AWSQueryConnection): instance_type=None, auto_scaling_type=None, hostname=None, os=None, ami_id=None, ssh_key_name=None, architecture=None, - install_updates_on_boot=None): + install_updates_on_boot=None, ebs_optimized=None): """ Updates a specified instance. @@ -2185,16 +2327,16 @@ class OpsWorksConnection(AWSQueryConnection): see `Instance Families and Types`_. :type install_updates_on_boot: boolean - :param install_updates_on_boot: - Whether to install operating system and package updates when the - instance boots. The default value is `True`. To control when - updates are installed, set this value to `False`. You must then - update your instances manually by using CreateDeployment to run the - `update_dependencies` stack command or manually running `yum` - (Amazon Linux) or `apt-get` (Ubuntu) on the instances. + :param install_updates_on_boot: Whether to install operating system and + package updates when the instance boots. The default value is + `True`. To control when updates are installed, set this value to + `False`. You must then update your instances manually by using + CreateDeployment to run the `update_dependencies` stack command or + manually running `yum` (Amazon Linux) or `apt-get` (Ubuntu) on the + instances. - We strongly recommend using the default value of `True`, to ensure that - your instances have the latest security updates. + :type ebs_optimized: boolean + :param ebs_optimized: Whether this is an Amazon EBS-optimized instance. """ params = {'InstanceId': instance_id, } @@ -2216,6 +2358,8 @@ class OpsWorksConnection(AWSQueryConnection): params['Architecture'] = architecture if install_updates_on_boot is not None: params['InstallUpdatesOnBoot'] = install_updates_on_boot + if ebs_optimized is not None: + params['EbsOptimized'] = ebs_optimized return self.make_request(action='UpdateInstance', body=json.dumps(params)) @@ -2225,7 +2369,8 @@ class OpsWorksConnection(AWSQueryConnection): volume_configurations=None, enable_auto_healing=None, auto_assign_elastic_ips=None, auto_assign_public_ips=None, custom_recipes=None, - install_updates_on_boot=None): + install_updates_on_boot=None, + use_ebs_optimized_instances=None): """ Updates a specified layer. @@ -2250,7 +2395,7 @@ class OpsWorksConnection(AWSQueryConnection): :type attributes: map :param attributes: One or more user-defined key/value pairs to be added - to the stack attributes bag. + to the stack attributes. :type custom_instance_profile_arn: string :param custom_instance_profile_arn: The ARN of an IAM profile to be @@ -2288,16 +2433,17 @@ class OpsWorksConnection(AWSQueryConnection): layer's custom recipes. :type install_updates_on_boot: boolean - :param install_updates_on_boot: - Whether to install operating system and package updates when the - instance boots. The default value is `True`. To control when - updates are installed, set this value to `False`. You must then - update your instances manually by using CreateDeployment to run the - `update_dependencies` stack command or manually running `yum` - (Amazon Linux) or `apt-get` (Ubuntu) on the instances. + :param install_updates_on_boot: Whether to install operating system and + package updates when the instance boots. The default value is + `True`. To control when updates are installed, set this value to + `False`. You must then update your instances manually by using + CreateDeployment to run the `update_dependencies` stack command or + manually running `yum` (Amazon Linux) or `apt-get` (Ubuntu) on the + instances. - We strongly recommend using the default value of `True`, to ensure that - your instances have the latest security updates. + :type use_ebs_optimized_instances: boolean + :param use_ebs_optimized_instances: Whether to use Amazon EBS-optimized + instances. """ params = {'LayerId': layer_id, } @@ -2325,6 +2471,8 @@ class OpsWorksConnection(AWSQueryConnection): params['CustomRecipes'] = custom_recipes if install_updates_on_boot is not None: params['InstallUpdatesOnBoot'] = install_updates_on_boot + if use_ebs_optimized_instances is not None: + params['UseEbsOptimizedInstances'] = use_ebs_optimized_instances return self.make_request(action='UpdateLayer', body=json.dumps(params)) @@ -2347,14 +2495,39 @@ class OpsWorksConnection(AWSQueryConnection): return self.make_request(action='UpdateMyUserProfile', body=json.dumps(params)) + def update_rds_db_instance(self, rds_db_instance_arn, db_user=None, + db_password=None): + """ + Updates an Amazon RDS instance. + + :type rds_db_instance_arn: string + :param rds_db_instance_arn: The Amazon RDS instance's ARN. + + :type db_user: string + :param db_user: The master user name. + + :type db_password: string + :param db_password: The database password. + + """ + params = {'RdsDbInstanceArn': rds_db_instance_arn, } + if db_user is not None: + params['DbUser'] = db_user + if db_password is not None: + params['DbPassword'] = db_password + return self.make_request(action='UpdateRdsDbInstance', + body=json.dumps(params)) + def update_stack(self, stack_id, name=None, attributes=None, service_role_arn=None, default_instance_profile_arn=None, default_os=None, hostname_theme=None, default_availability_zone=None, default_subnet_id=None, custom_json=None, - configuration_manager=None, use_custom_cookbooks=None, - custom_cookbooks_source=None, default_ssh_key_name=None, - default_root_device_type=None): + configuration_manager=None, chef_configuration=None, + use_custom_cookbooks=None, custom_cookbooks_source=None, + default_ssh_key_name=None, + default_root_device_type=None, + use_opsworks_security_groups=None): """ Updates a specified stack. @@ -2372,20 +2545,14 @@ class OpsWorksConnection(AWSQueryConnection): :type attributes: map :param attributes: One or more user-defined key/value pairs to be added - to the stack attributes bag. + to the stack attributes. :type service_role_arn: string - :param service_role_arn: - The stack AWS Identity and Access Management (IAM) role, which allows - AWS OpsWorks to work with AWS resources on your behalf. You must - set this parameter to the Amazon Resource Name (ARN) for an - existing IAM role. For more information about IAM ARNs, see `Using - Identifiers`_. - - You must set this parameter to a valid service role ARN or the action - will fail; there is no default value. You can specify the stack's - current service role ARN, if you prefer, but you must do so - explicitly. + :param service_role_arn: The stack AWS Identity and Access Management + (IAM) role, which allows AWS OpsWorks to work with AWS resources on + your behalf. You must set this parameter to the Amazon Resource + Name (ARN) for an existing IAM role. For more information about IAM + ARNs, see `Using Identifiers`_. :type default_instance_profile_arn: string :param default_instance_profile_arn: The ARN of an IAM profile that is @@ -2438,16 +2605,22 @@ class OpsWorksConnection(AWSQueryConnection): :param custom_json: A string that contains user-defined, custom JSON. It is used to override the corresponding default stack configuration JSON values. The string should be in the following - format and must escape characters such as '"'.: `"{\"key1\": - \"value1\", \"key2\": \"value2\",...}"` + format and must escape characters such as '"'.: + `"{\"key1\": \"value1\", \"key2\": \"value2\",...}"` + For more information on custom JSON, see `Use Custom JSON to Modify the Stack Configuration JSON`_. :type configuration_manager: dict - :param configuration_manager: The configuration manager. When you - update a stack you can optionally use the configuration manager to - specify the Chef version, 0.9 or 11.4. If you omit this parameter, - AWS OpsWorks does not change the Chef version. + :param configuration_manager: The configuration manager. When you clone + a stack we recommend that you use the configuration manager to + specify the Chef version, 0.9, 11.4, or 11.10. The default value is + currently 11.4. + + :type chef_configuration: dict + :param chef_configuration: A `ChefConfiguration` object that specifies + whether to enable Berkshelf and the Berkshelf version on Chef 11.10 + stacks. For more information, see `Create a New Stack`_. :type use_custom_cookbooks: boolean :param use_custom_cookbooks: Whether the stack uses custom cookbooks. @@ -2464,9 +2637,33 @@ class OpsWorksConnection(AWSQueryConnection): :type default_root_device_type: string :param default_root_device_type: The default root device type. This - value is used by default for all instances in the cloned stack, but - you can override it when you create an instance. For more - information, see `Storage for the Root Device`_. + value is used by default for all instances in the stack, but you + can override it when you create an instance. For more information, + see `Storage for the Root Device`_. + + :type use_opsworks_security_groups: boolean + :param use_opsworks_security_groups: Whether to associate the AWS + OpsWorks built-in security groups with the stack's layers. + AWS OpsWorks provides a standard set of built-in security groups, one + for each layer, which are associated with layers by default. + `UseOpsworksSecurityGroups` allows you to instead provide your own + custom security groups. `UseOpsworksSecurityGroups` has the + following settings: + + + + True - AWS OpsWorks automatically associates the appropriate built-in + security group with each layer (default setting). You can associate + additional security groups with a layer after you create it but you + cannot delete the built-in security group. + + False - AWS OpsWorks does not associate built-in security groups with + layers. You must create appropriate EC2 security groups and + associate a security group with each layer that you create. + However, you can still manually associate a built-in security group + with a layer on creation; custom security groups are required only + for those layers that need custom settings. + + + For more information, see `Create a New Stack`_. """ params = {'StackId': stack_id, } @@ -2490,6 +2687,8 @@ class OpsWorksConnection(AWSQueryConnection): params['CustomJson'] = custom_json if configuration_manager is not None: params['ConfigurationManager'] = configuration_manager + if chef_configuration is not None: + params['ChefConfiguration'] = chef_configuration if use_custom_cookbooks is not None: params['UseCustomCookbooks'] = use_custom_cookbooks if custom_cookbooks_source is not None: @@ -2498,6 +2697,8 @@ class OpsWorksConnection(AWSQueryConnection): params['DefaultSshKeyName'] = default_ssh_key_name if default_root_device_type is not None: params['DefaultRootDeviceType'] = default_root_device_type + if use_opsworks_security_groups is not None: + params['UseOpsworksSecurityGroups'] = use_opsworks_security_groups return self.make_request(action='UpdateStack', body=json.dumps(params)) @@ -2515,7 +2716,12 @@ class OpsWorksConnection(AWSQueryConnection): :param iam_user_arn: The user IAM ARN. :type ssh_username: string - :param ssh_username: The user's new SSH user name. + :param ssh_username: The user's SSH user name. The allowable characters + are [a-z], [A-Z], [0-9], '-', and '_'. If the specified name + includes other punctuation marks, AWS OpsWorks removes them. For + example, `my.name` will be changed to `myname`. If you do not + specify an SSH user name, AWS OpsWorks generates one from the IAM + user name. :type ssh_public_key: string :param ssh_public_key: The user's new SSH public key. |