AWS OpsWorks

2016/04/28 - AWS OpsWorks - 3 updated api methods

Changes  Update opsworks client to latest version

CreateDeployment (updated) Link ¶
Changes (request)
{'LayerIds': ['string']}

Runs deployment or stack commands. For more information, see Deploying Apps and Run Stack Commands.

Required Permissions: To use this action, an IAM user must have a Deploy or Manage permissions level for the stack, or an attached policy that explicitly grants permissions. For more information on user permissions, see Managing User Permissions.

Request Syntax

client.create_deployment(
    StackId='string',
    AppId='string',
    InstanceIds=[
        'string',
    ],
    LayerIds=[
        'string',
    ],
    Command={
        'Name': 'install_dependencies'|'update_dependencies'|'update_custom_cookbooks'|'execute_recipes'|'configure'|'setup'|'deploy'|'rollback'|'start'|'stop'|'restart'|'undeploy',
        'Args': {
            'string': [
                'string',
            ]
        }
    },
    Comment='string',
    CustomJson='string'
)
type StackId:

string

param StackId:

[REQUIRED]

The stack ID.

type AppId:

string

param AppId:

The app ID. This parameter is required for app deployments, but not for other deployment commands.

type InstanceIds:

list

param InstanceIds:

The instance IDs for the deployment targets.

  • (string) --

type LayerIds:

list

param LayerIds:

The layer IDs for the deployment targets.

  • (string) --

type Command:

dict

param Command:

[REQUIRED]

A DeploymentCommand object that specifies the deployment command and any associated arguments.

  • Name (string) -- [REQUIRED]

    Specifies the operation. You can specify only one command.

    For stacks, the following commands are available:

    • execute_recipes: Execute one or more recipes. To specify the recipes, set an Args parameter named recipes to the list of recipes to be executed. For example, to execute phpapp::appsetup, set Args to {"recipes":["phpapp::appsetup"]}.

    • install_dependencies: Install the stack's dependencies.

    • update_custom_cookbooks: Update the stack's custom cookbooks.

    • update_dependencies: Update the stack's dependencies.

    For apps, the following commands are available:

    • deploy: Deploy an app. Ruby on Rails apps have an optional Args parameter named migrate. Set Args to {"migrate":["true"]} to migrate the database. The default setting is {"migrate":["false"]}.

    • rollback Roll the app back to the previous version. When you update an app, AWS OpsWorks stores the previous version, up to a maximum of five versions. You can use this command to roll an app back as many as four versions.

    • start: Start the app's web or application server.

    • stop: Stop the app's web or application server.

    • restart: Restart the app's web or application server.

    • undeploy: Undeploy the app.

  • Args (dict) --

    The arguments of those commands that take arguments. It should be set to a JSON object with the following format:

    {"arg_name1" : ["value1", "value2", ...], "arg_name2" : ["value1", "value2", ...], ...}

    The update_dependencies command takes two arguments:

    • upgrade_os_to - Specifies the desired Amazon Linux version for instances whose OS you want to upgrade, such as Amazon Linux 2014.09. You must also set the allow_reboot argument to true.

    • allow_reboot - Specifies whether to allow AWS OpsWorks to reboot the instances if necessary, after installing the updates. This argument can be set to either true or false. The default value is false.

    For example, to upgrade an instance to Amazon Linux 2014.09, set Args to the following.

    `` { "upgrade_os_to":["Amazon Linux 2014.09"], "allow_reboot":["true"] }``

    • (string) --

      • (list) --

        • (string) --

type Comment:

string

param Comment:

A user-defined comment.

type CustomJson:

string

param CustomJson:

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\",...}"

For more information on custom JSON, see Use Custom JSON to Modify the Stack Configuration Attributes.

rtype:

dict

returns:

Response Syntax

{
    'DeploymentId': 'string'
}

Response Structure

  • (dict) --

    Contains the response to a CreateDeployment request.

    • DeploymentId (string) --

      The deployment ID, which can be used with other requests to identify the deployment.

CreateInstance (updated) Link ¶
Changes (request)
{'Tenancy': 'string'}

Creates an instance in a specified stack. For more information, see Adding an Instance to a Layer.

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 information on user permissions, see Managing User Permissions.

Request Syntax

client.create_instance(
    StackId='string',
    LayerIds=[
        'string',
    ],
    InstanceType='string',
    AutoScalingType='load'|'timer',
    Hostname='string',
    Os='string',
    AmiId='string',
    SshKeyName='string',
    AvailabilityZone='string',
    VirtualizationType='string',
    SubnetId='string',
    Architecture='x86_64'|'i386',
    RootDeviceType='ebs'|'instance-store',
    BlockDeviceMappings=[
        {
            'DeviceName': 'string',
            'NoDevice': 'string',
            'VirtualName': 'string',
            'Ebs': {
                'SnapshotId': 'string',
                'Iops': 123,
                'VolumeSize': 123,
                'VolumeType': 'gp2'|'io1'|'standard',
                'DeleteOnTermination': True|False
            }
        },
    ],
    InstallUpdatesOnBoot=True|False,
    EbsOptimized=True|False,
    AgentVersion='string',
    Tenancy='string'
)
type StackId:

string

param StackId:

[REQUIRED]

The stack ID.

type LayerIds:

list

param LayerIds:

[REQUIRED]

An array that contains the instance's layer IDs.

  • (string) --

type InstanceType:

string

param InstanceType:

[REQUIRED]

The instance type, such as t2.micro. For a list of supported instance types, open the stack in the console, choose Instances, and choose + Instance. The Size list contains the currently supported types. For more information, see Instance Families and Types. The parameter values that you use to specify the various types are in the API Name column of the Available Instance Types table.

type AutoScalingType:

string

param AutoScalingType:

For load-based or time-based instances, the type. Windows stacks can use only time-based instances.

type Hostname:

string

param Hostname:

The instance host name.

type Os:

string

param Os:

The instance's operating system, which must be set to one of the following.

  • A supported Linux operating system: An Amazon Linux version, such as Amazon Linux 2015.03, Red Hat Enterprise Linux 7, Ubuntu 12.04 LTS, or Ubuntu 14.04 LTS.

  • Microsoft Windows Server 2012 R2 Base.

  • A custom AMI: Custom.

For more information on the supported operating systems, see AWS OpsWorks Operating Systems.

The default option is the current Amazon Linux version. If you set this parameter to Custom, you must use the CreateInstance action's AmiId parameter to specify the custom AMI that you want to use. Block device mappings are not supported if the value is Custom. For more information on the supported operating systems, see Operating Systems <http://docs.aws.amazon.com/opsworks/latest/userguide/workinginstances-os.html>`__For more information on how to use custom AMIs with AWS OpsWorks, see `Using Custom AMIs.

type AmiId:

string

param AmiId:

A custom AMI ID to be used to create the instance. The AMI should be based on one of the supported operating systems. For more information, see Using Custom AMIs.

type SshKeyName:

string

param SshKeyName:

The instance's Amazon EC2 key-pair name.

type AvailabilityZone:

string

param AvailabilityZone:

The instance Availability Zone. For more information, see Regions and Endpoints.

type VirtualizationType:

string

param VirtualizationType:

The instance's virtualization type, paravirtual or hvm.

type SubnetId:

string

param SubnetId:

The ID of the instance's subnet. If the stack is running in a VPC, you can use this parameter to override the stack's default subnet ID value and direct AWS OpsWorks to launch the instance in a different subnet.

type Architecture:

string

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 RootDeviceType:

string

param RootDeviceType:

The instance root device type. For more information, see Storage for the Root Device.

type BlockDeviceMappings:

list

param BlockDeviceMappings:

An array of BlockDeviceMapping objects that specify the instance's block devices. For more information, see Block Device Mapping. Note that block device mappings are not supported for custom AMIs.

  • (dict) --

    Describes a block device mapping. This data type maps directly to the Amazon EC2 BlockDeviceMapping data type.

    • DeviceName (string) --

      The device name that is exposed to the instance, such as /dev/sdh. For the root device, you can use the explicit device name or you can set this parameter to ROOT_DEVICE and AWS OpsWorks will provide the correct device name.

    • NoDevice (string) --

      Suppresses the specified device included in the AMI's block device mapping.

    • VirtualName (string) --

      The virtual device name. For more information, see BlockDeviceMapping.

    • Ebs (dict) --

      An EBSBlockDevice that defines how to configure an Amazon EBS volume when the instance is launched.

      • SnapshotId (string) --

        The snapshot ID.

      • Iops (integer) --

        The number of I/O operations per second (IOPS) that the volume supports. For more information, see EbsBlockDevice.

      • VolumeSize (integer) --

        The volume size, in GiB. For more information, see EbsBlockDevice.

      • VolumeType (string) --

        The volume type. gp2 for General Purpose (SSD) volumes, io1 for Provisioned IOPS (SSD) volumes, and standard for Magnetic volumes.

      • DeleteOnTermination (boolean) --

        Whether the volume is deleted on instance termination.

type InstallUpdatesOnBoot:

boolean

param InstallUpdatesOnBoot:

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 by manually running yum (Amazon Linux) or apt-get (Ubuntu) on the instances.

type EbsOptimized:

boolean

param EbsOptimized:

Whether to create an Amazon EBS-optimized instance.

type AgentVersion:

string

param AgentVersion:

The default AWS OpsWorks agent version. You have the following options:

  • INHERIT - Use the stack's default agent version setting.

  • version_number - Use the specified agent version. This value overrides the stack's default setting. To update the agent version, edit the instance configuration and specify a new version. AWS OpsWorks then automatically installs that version on the instance.

The default setting is INHERIT. To specify an agent version, you must use the complete version number, not the abbreviated number shown on the console. For a list of available agent version numbers, call DescribeAgentVersions.

type Tenancy:

string

param Tenancy:

The instance's tenancy option. The default option is no tenancy, or if the instance is running in a VPC, inherit tenancy settings from the VPC. The following are valid values for this parameter: dedicated, default, or host. Because there are costs associated with changes in tenancy options, we recommend that you research tenancy options before choosing them for your instances. For more information about dedicated hosts, see Dedicated Hosts Overview and Amazon EC2 Dedicated Hosts. For more information about dedicated instances, see Dedicated Instances and Amazon EC2 Dedicated Instances.

rtype:

dict

returns:

Response Syntax

{
    'InstanceId': 'string'
}

Response Structure

  • (dict) --

    Contains the response to a CreateInstance request.

    • InstanceId (string) --

      The instance ID.

DescribeInstances (updated) Link ¶
Changes (response)
{'Instances': {'Tenancy': 'string'}}

Requests a description of a set of instances.

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 permissions. For more information on user permissions, see Managing User Permissions.

Request Syntax

client.describe_instances(
    StackId='string',
    LayerId='string',
    InstanceIds=[
        'string',
    ]
)
type StackId:

string

param StackId:

A stack ID. If you use this parameter, DescribeInstances returns descriptions of the instances associated with the specified stack.

type LayerId:

string

param LayerId:

A layer ID. If you use this parameter, DescribeInstances returns descriptions of the instances associated with the specified layer.

type InstanceIds:

list

param InstanceIds:

An array of instance IDs to be described. If you use this parameter, DescribeInstances returns a description of the specified instances. Otherwise, it returns a description of every instance.

  • (string) --

rtype:

dict

returns:

Response Syntax

{
    'Instances': [
        {
            'AgentVersion': 'string',
            'AmiId': 'string',
            'Architecture': 'x86_64'|'i386',
            'AutoScalingType': 'load'|'timer',
            'AvailabilityZone': 'string',
            'BlockDeviceMappings': [
                {
                    'DeviceName': 'string',
                    'NoDevice': 'string',
                    'VirtualName': 'string',
                    'Ebs': {
                        'SnapshotId': 'string',
                        'Iops': 123,
                        'VolumeSize': 123,
                        'VolumeType': 'gp2'|'io1'|'standard',
                        'DeleteOnTermination': True|False
                    }
                },
            ],
            'CreatedAt': 'string',
            'EbsOptimized': True|False,
            'Ec2InstanceId': 'string',
            'EcsClusterArn': 'string',
            'EcsContainerInstanceArn': 'string',
            'ElasticIp': 'string',
            'Hostname': 'string',
            'InfrastructureClass': 'string',
            'InstallUpdatesOnBoot': True|False,
            'InstanceId': 'string',
            'InstanceProfileArn': 'string',
            'InstanceType': 'string',
            'LastServiceErrorId': 'string',
            'LayerIds': [
                'string',
            ],
            'Os': 'string',
            'Platform': 'string',
            'PrivateDns': 'string',
            'PrivateIp': 'string',
            'PublicDns': 'string',
            'PublicIp': 'string',
            'RegisteredBy': 'string',
            'ReportedAgentVersion': 'string',
            'ReportedOs': {
                'Family': 'string',
                'Name': 'string',
                'Version': 'string'
            },
            'RootDeviceType': 'ebs'|'instance-store',
            'RootDeviceVolumeId': 'string',
            'SecurityGroupIds': [
                'string',
            ],
            'SshHostDsaKeyFingerprint': 'string',
            'SshHostRsaKeyFingerprint': 'string',
            'SshKeyName': 'string',
            'StackId': 'string',
            'Status': 'string',
            'SubnetId': 'string',
            'Tenancy': 'string',
            'VirtualizationType': 'paravirtual'|'hvm'
        },
    ]
}

Response Structure

  • (dict) --

    Contains the response to a DescribeInstances request.

    • Instances (list) --

      An array of Instance objects that describe the instances.

      • (dict) --

        Describes an instance.

        • AgentVersion (string) --

          The agent version. This parameter is set to INHERIT if the instance inherits the default stack setting or to a a version number for a fixed agent version.

        • AmiId (string) --

          A custom AMI ID to be used to create the instance. For more information, see Instances

        • Architecture (string) --

          The instance architecture: "i386" or "x86_64".

        • AutoScalingType (string) --

          For load-based or time-based instances, the type.

        • AvailabilityZone (string) --

          The instance Availability Zone. For more information, see Regions and Endpoints.

        • BlockDeviceMappings (list) --

          An array of BlockDeviceMapping objects that specify the instance's block device mappings.

          • (dict) --

            Describes a block device mapping. This data type maps directly to the Amazon EC2 BlockDeviceMapping data type.

            • DeviceName (string) --

              The device name that is exposed to the instance, such as /dev/sdh. For the root device, you can use the explicit device name or you can set this parameter to ROOT_DEVICE and AWS OpsWorks will provide the correct device name.

            • NoDevice (string) --

              Suppresses the specified device included in the AMI's block device mapping.

            • VirtualName (string) --

              The virtual device name. For more information, see BlockDeviceMapping.

            • Ebs (dict) --

              An EBSBlockDevice that defines how to configure an Amazon EBS volume when the instance is launched.

              • SnapshotId (string) --

                The snapshot ID.

              • Iops (integer) --

                The number of I/O operations per second (IOPS) that the volume supports. For more information, see EbsBlockDevice.

              • VolumeSize (integer) --

                The volume size, in GiB. For more information, see EbsBlockDevice.

              • VolumeType (string) --

                The volume type. gp2 for General Purpose (SSD) volumes, io1 for Provisioned IOPS (SSD) volumes, and standard for Magnetic volumes.

              • DeleteOnTermination (boolean) --

                Whether the volume is deleted on instance termination.

        • CreatedAt (string) --

          The time that the instance was created.

        • EbsOptimized (boolean) --

          Whether this is an Amazon EBS-optimized instance.

        • Ec2InstanceId (string) --

          The ID of the associated Amazon EC2 instance.

        • EcsClusterArn (string) --

          For container instances, the Amazon ECS cluster's ARN.

        • EcsContainerInstanceArn (string) --

          For container instances, the instance's ARN.

        • ElasticIp (string) --

          The instance Elastic IP address.

        • Hostname (string) --

          The instance host name.

        • InfrastructureClass (string) --

          For registered instances, the infrastructure class: ec2 or on-premises.

        • InstallUpdatesOnBoot (boolean) --

          Whether to install operating system and package updates when the instance boots. The default value is true. If this value is set to false, you must then update your instances manually by using CreateDeployment to run the update_dependencies stack command or by manually running yum (Amazon Linux) or apt-get (Ubuntu) on the instances.

        • InstanceId (string) --

          The instance ID.

        • InstanceProfileArn (string) --

          The ARN of the instance's IAM profile. For more information about IAM ARNs, see Using Identifiers.

        • InstanceType (string) --

          The instance type, such as t2.micro.

        • LastServiceErrorId (string) --

          The ID of the last service error. For more information, call DescribeServiceErrors.

        • LayerIds (list) --

          An array containing the instance layer IDs.

          • (string) --

        • Os (string) --

          The instance's operating system.

        • Platform (string) --

          The instance's platform.

        • PrivateDns (string) --

          The The instance's private DNS name.

        • PrivateIp (string) --

          The instance's private IP address.

        • PublicDns (string) --

          The instance public DNS name.

        • PublicIp (string) --

          The instance public IP address.

        • RegisteredBy (string) --

          For registered instances, who performed the registration.

        • ReportedAgentVersion (string) --

          The instance's reported AWS OpsWorks agent version.

        • ReportedOs (dict) --

          For registered instances, the reported operating system.

          • Family (string) --

            The operating system family.

          • Name (string) --

            The operating system name.

          • Version (string) --

            The operating system version.

        • RootDeviceType (string) --

          The instance's root device type. For more information, see Storage for the Root Device.

        • RootDeviceVolumeId (string) --

          The root device volume ID.

        • SecurityGroupIds (list) --

          An array containing the instance security group IDs.

          • (string) --

        • SshHostDsaKeyFingerprint (string) --

          The SSH key's Deep Security Agent (DSA) fingerprint.

        • SshHostRsaKeyFingerprint (string) --

          The SSH key's RSA fingerprint.

        • SshKeyName (string) --

          The instance's Amazon EC2 key-pair name.

        • StackId (string) --

          The stack ID.

        • Status (string) --

          The instance status:

          • booting

          • connection_lost

          • online

          • pending

          • rebooting

          • requested

          • running_setup

          • setup_failed

          • shutting_down

          • start_failed

          • stopped

          • stopping

          • terminated

          • terminating

        • SubnetId (string) --

          The instance's subnet ID; applicable only if the stack is running in a VPC.

        • Tenancy (string) --

          The instance's tenancy option, such as dedicated or host.

        • VirtualizationType (string) --

          The instance's virtualization type: paravirtual or hvm.