-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CLI examples for cloudfront, ec2, ivs, rds, securitylake
- Loading branch information
Showing
35 changed files
with
1,116 additions
and
1,057 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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*. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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*. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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*. |
Oops, something went wrong.