Skip to content

Commit

Permalink
CLI examples for cloudfront, ec2, ivs, rds, securitylake
Browse files Browse the repository at this point in the history
  • Loading branch information
elysahall committed Nov 19, 2024
1 parent 9b96a50 commit faa3031
Show file tree
Hide file tree
Showing 35 changed files with 1,116 additions and 1,057 deletions.
22 changes: 9 additions & 13 deletions awscli/examples/cloudfront/create-distribution-with-tags.rst
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
**To create a CloudFront distribution with tags**

The following example creates a distribution with two tags by providing the
distribution configuration and tags in a JSON file named
``dist-config-with-tags.json``::
The following ``create-distribution-with-tags`` example creates a distribution with two tags by providing the distribution configuration and tags in a JSON file named ``dist-config-with-tags.json``. ::

aws cloudfront create-distribution-with-tags \
--distribution-config-with-tags file://dist-config-with-tags.json

The file ``dist-config-with-tags.json`` is a JSON document in the current
folder that contains the following. Note the ``Tags`` object at the top of
the file, which contains two tags:
The file ``dist-config-with-tags.json`` is a JSON document in the current folder. Note the ``Tags`` object at the top of the file, which contains two tags:

- ``Name = ExampleDistribution``
- ``Project = ExampleProject``

::
Contents of ``dist-config-with-tags.json``::

{
"Tags": {
Expand All @@ -39,8 +35,8 @@ the file, which contains two tags:
"Quantity": 1,
"Items": [
{
"Id": "awsexamplebucket.s3.amazonaws.com-cli-example",
"DomainName": "awsexamplebucket.s3.amazonaws.com",
"Id": "amzn-s3-demo-bucket.s3.amazonaws.com-cli-example",
"DomainName": "amzn-s3-demo-bucket.s3.amazonaws.com",
"OriginPath": "",
"CustomHeaders": {
"Quantity": 0
Expand All @@ -55,7 +51,7 @@ the file, which contains two tags:
"Quantity": 0
},
"DefaultCacheBehavior": {
"TargetOriginId": "awsexamplebucket.s3.amazonaws.com-cli-example",
"TargetOriginId": "amzn-s3-demo-bucket.s3.amazonaws.com-cli-example",
"ForwardedValues": {
"QueryString": false,
"Cookies": {
Expand Down Expand Up @@ -155,8 +151,8 @@ Output::
"Quantity": 1,
"Items": [
{
"Id": "awsexamplebucket.s3.amazonaws.com-cli-example",
"DomainName": "awsexamplebucket.s3.amazonaws.com",
"Id": "amzn-s3-demo-bucket.s3.amazonaws.com-cli-example",
"DomainName": "amzn-s3-demo-bucket.s3.amazonaws.com",
"OriginPath": "",
"CustomHeaders": {
"Quantity": 0
Expand All @@ -171,7 +167,7 @@ Output::
"Quantity": 0
},
"DefaultCacheBehavior": {
"TargetOriginId": "awsexamplebucket.s3.amazonaws.com-cli-example",
"TargetOriginId": "amzn-s3-demo-bucket.s3.amazonaws.com-cli-example",
"ForwardedValues": {
"QueryString": false,
"Cookies": {
Expand Down
16 changes: 6 additions & 10 deletions awscli/examples/cloudfront/get-distribution.rst
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
**To get a CloudFront distribution**

The following example gets the CloudFront distribution with the ID
``EDFDVBD6EXAMPLE``, including its ``ETag``. The distribution ID is returned in
the `create-distribution <create-distribution.html>`_ and `list-distributions
<list-distributions.html>`_ commands.
The following ``get-distribution`` example gets the CloudFront distribution with the ID ``EDFDVBD6EXAMPLE``, including its ``ETag``. The distribution ID is returned in the `create-distribution <create-distribution.html>`__ and `list-distributions <list-distributions.html>`__ commands. ::

::

aws cloudfront get-distribution --id EDFDVBD6EXAMPLE
aws cloudfront get-distribution \
--id EDFDVBD6EXAMPLE

Output::

Expand All @@ -34,8 +30,8 @@ Output::
"Quantity": 1,
"Items": [
{
"Id": "awsexamplebucket.s3.amazonaws.com-cli-example",
"DomainName": "awsexamplebucket.s3.amazonaws.com",
"Id": "amzn-s3-demo-bucket.s3.amazonaws.com-cli-example",
"DomainName": "amzn-s3-demo-bucket.s3.amazonaws.com",
"OriginPath": "",
"CustomHeaders": {
"Quantity": 0
Expand All @@ -50,7 +46,7 @@ Output::
"Quantity": 0
},
"DefaultCacheBehavior": {
"TargetOriginId": "awsexamplebucket.s3.amazonaws.com-cli-example",
"TargetOriginId": "amzn-s3-demo-bucket.s3.amazonaws.com-cli-example",
"ForwardedValues": {
"QueryString": false,
"Cookies": {
Expand Down
2 changes: 1 addition & 1 deletion awscli/examples/ec2/accept-address-transfer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ Output::
}
}

For more information, see `Transfer Elastic IP addresses <https://docs.aws.amazon.com/vpc/latest/userguide/vpc-eips.html#transfer-EIPs-intro>`__ in the *Amazon VPC User Guide*.
For more information, see `Transfer Elastic IP addresses <https://docs.aws.amazon.com/vpc/latest/userguide/WorkWithEIPs.html#transfer-EIPs-intro>`__ in the *Amazon VPC User Guide*.
110 changes: 55 additions & 55 deletions awscli/examples/ec2/allocate-hosts.rst
Original file line number Diff line number Diff line change
@@ -1,55 +1,55 @@
**Example 1: To allocate a Dedicated Host**

The following ``allocate-hosts`` example allocates a single Dedicated Host in the ``eu-west-1a`` Availability Zone, onto which you can launch ``m5.large`` instances. By default, the Dedicated Host accepts only target instance launches, and does not support host recovery. ::

aws ec2 allocate-hosts \
--instance-type m5.large \
--availability-zone eu-west-1a \
--quantity 1

Output::

{
"HostIds": [
"h-07879acf49EXAMPLE"
]
}

**Example 2: To allocate a Dedicated Host with auto-placement and host recovery enabled**

The following ``allocate-hosts`` example allocates a single Dedicated Host in the ``eu-west-1a`` Availability Zone with auto-placement and host recovery enabled. ::

aws ec2 allocate-hosts \
--instance-type m5.large \
--availability-zone eu-west-1a \
--auto-placement on \
--host-recovery on \
--quantity 1

Output::

{
"HostIds": [
"h-07879acf49EXAMPLE"
]
}

**Example 3: To allocate a Dedicated Host with tags**

The following ``allocate-hosts`` example allocates a single Dedicated Host and applies a tag with a key named ``purpose`` and a value of ``production``. ::

aws ec2 allocate-hosts \
--instance-type m5.large \
--availability-zone eu-west-1a \
--quantity 1 \
--tag-specifications 'ResourceType=dedicated-host,Tags={Key=purpose,Value=production}'

Output::

{
"HostIds": [
"h-07879acf49EXAMPLE"
]
}

For more information, see `Allocating Dedicated Hosts <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/how-dedicated-hosts-work.html#dedicated-hosts-allocating>`__ in the *Amazon Elastic Compute Cloud User Guide for Linux Instances*.
**Example 1: To allocate a Dedicated Host**

The following ``allocate-hosts`` example allocates a single Dedicated Host in the ``eu-west-1a`` Availability Zone, onto which you can launch ``m5.large`` instances. By default, the Dedicated Host accepts only target instance launches, and does not support host recovery. ::

aws ec2 allocate-hosts \
--instance-type m5.large \
--availability-zone eu-west-1a \
--quantity 1

Output::

{
"HostIds": [
"h-07879acf49EXAMPLE"
]
}

**Example 2: To allocate a Dedicated Host with auto-placement and host recovery enabled**

The following ``allocate-hosts`` example allocates a single Dedicated Host in the ``eu-west-1a`` Availability Zone with auto-placement and host recovery enabled. ::

aws ec2 allocate-hosts \
--instance-type m5.large \
--availability-zone eu-west-1a \
--auto-placement on \
--host-recovery on \
--quantity 1

Output::

{
"HostIds": [
"h-07879acf49EXAMPLE"
]
}

**Example 3: To allocate a Dedicated Host with tags**

The following ``allocate-hosts`` example allocates a single Dedicated Host and applies a tag with a key named ``purpose`` and a value of ``production``. ::

aws ec2 allocate-hosts \
--instance-type m5.large \
--availability-zone eu-west-1a \
--quantity 1 \
--tag-specifications 'ResourceType=dedicated-host,Tags={Key=purpose,Value=production}'

Output::

{
"HostIds": [
"h-07879acf49EXAMPLE"
]
}

For more information, see `Allocate a Dedicated Host <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/dedicated-hosts-allocating.html>`__ in the *Amazon EC2 User Guide*.
79 changes: 44 additions & 35 deletions awscli/examples/ec2/associate-address.rst
Original file line number Diff line number Diff line change
@@ -1,35 +1,44 @@
**To associate an Elastic IP addresses in EC2-Classic**

This example associates an Elastic IP address with an instance in EC2-Classic. If the command succeeds, no output is returned.

Command::

aws ec2 associate-address --instance-id i-07ffe74c7330ebf53 --public-ip 198.51.100.0

**To associate an Elastic IP address in EC2-VPC**

This example associates an Elastic IP address with an instance in a VPC.

Command::

aws ec2 associate-address --instance-id i-0b263919b6498b123 --allocation-id eipalloc-64d5890a

Output::

{
"AssociationId": "eipassoc-2bebb745"
}

This example associates an Elastic IP address with a network interface.

Command::

aws ec2 associate-address --allocation-id eipalloc-64d5890a --network-interface-id eni-1a2b3c4d

This example associates an Elastic IP with a private IP address that's associated with a network interface.

Command::

aws ec2 associate-address --allocation-id eipalloc-64d5890a --network-interface-id eni-1a2b3c4d --private-ip-address 10.0.0.85

**Example 1: To associate an Elastic IP address with an instance**

The following ``associate-address`` example associates an Elastic IP address with the specified EC2 instance. ::

aws ec2 associate-address \
--instance-id i-0b263919b6498b123 \
--allocation-id eipalloc-64d5890a

Output::

{
"AssociationId": "eipassoc-2bebb745"
}

**Example 2: To associate an Elastic IP address with a network interface**

The following ``associate-address`` example associates the specified Elastic IP address with the specified network interface. ::

aws ec2 associate-address
--allocation-id eipalloc-64d5890a \
--network-interface-id eni-1a2b3c4d

Output::

{
"AssociationId": "eipassoc-2bebb745"
}

**Example 3: To associate an Elastic IP address with a private IP address**

The following ``associate-address`` example associates the specified Elastic IP address with the specified private IP address in the specified network interface. ::

aws ec2 associate-address \
--allocation-id eipalloc-64d5890a \
--network-interface-id eni-1a2b3c4d \
--private-ip-address 10.0.0.85

Output::

{
"AssociationId": "eipassoc-2bebb745"
}

For more information, see `Elastic IP addresses <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/elastic-ip-addresses-eip.html>`__ in the *Amazon EC2 User Guide*.
79 changes: 56 additions & 23 deletions awscli/examples/ec2/authorize-security-group-egress.rst
Original file line number Diff line number Diff line change
@@ -1,23 +1,56 @@
**To add a rule that allows outbound traffic to a specific address range**

This example command adds a rule that grants access to the specified address ranges on TCP port 80.

Command (Linux)::

aws ec2 authorize-security-group-egress --group-id sg-1a2b3c4d --ip-permissions IpProtocol=tcp,FromPort=80,ToPort=80,IpRanges='[{CidrIp=10.0.0.0/16}]'

Command (Windows)::

aws ec2 authorize-security-group-egress --group-id sg-1a2b3c4d --ip-permissions IpProtocol=tcp,FromPort=80,ToPort=80,IpRanges=[{CidrIp=10.0.0.0/16}]

**To add a rule that allows outbound traffic to a specific security group**

This example command adds a rule that grants access to the specified security group on TCP port 80.

Command (Linux)::

aws ec2 authorize-security-group-egress --group-id sg-1a2b3c4d --ip-permissions IpProtocol=tcp,FromPort=80,ToPort=80,UserIdGroupPairs='[{GroupId=sg-4b51a32f}]'

Command (Windows)::

aws ec2 authorize-security-group-egress --group-id sg-1a2b3c4d --ip-permissions IpProtocol=tcp,FromPort=80,ToPort=80,UserIdGroupPairs=[{GroupId=sg-4b51a32f}]
**Example 1: To add a rule that allows outbound traffic to a specific address range**

The following ``authorize-security-group-egress`` example adds a rule that grants access to the specified address ranges on TCP port 80. ::

aws ec2 authorize-security-group-egress \
--group-id sg-1234567890abcdef0 \
--ip-permissions 'IpProtocol=tcp,FromPort=80,ToPort=80,IpRanges=[{CidrIp=10.0.0.0/16}]'

Output::

{
"Return": true,
"SecurityGroupRules": [
{
"SecurityGroupRuleId": "sgr-0b15794cdb17bf29c",
"GroupId": "sg-1234567890abcdef0",
"GroupOwnerId": "123456789012",
"IsEgress": true,
"IpProtocol": "tcp",
"FromPort": 80,
"ToPort": 80,
"CidrIpv4": "10.0.0.0/16"
}
]
}

**Example 2: To add a rule that allows outbound traffic to a specific security group**

The following ``authorize-security-group-egress`` example adds a rule that grants access to the specified security group on TCP port 80. ::

aws ec2 authorize-security-group-egress \
--group-id sg-1234567890abcdef0 \
--ip-permissions 'IpProtocol=tcp,FromPort=80,ToPort=80,UserIdGroupPairs=[{GroupId=sg-0aad1c26bbeec5c22}]'

Output::

{
"Return": true,
"SecurityGroupRules": [
{
"SecurityGroupRuleId": "sgr-0b5dd815afcea9cc3",
"GroupId": "sg-1234567890abcdef0",
"GroupOwnerId": "123456789012",
"IsEgress": true,
"IpProtocol": "tcp",
"FromPort": 80,
"ToPort": 80,
"ReferencedGroupInfo": {
"GroupId": "sg-0aad1c26bbeec5c22",
"UserId": "123456789012"
}
}
]
}

For more information, see `Security groups <https://docs.aws.amazon.com/vpc/latest/userguide/vpc-security-groups.html>`__ in the *Amazon VPC User Guide*.
Loading

0 comments on commit faa3031

Please sign in to comment.