1回答
- 新しい順
- 投票が多い順
- コメントが多い順
0
動作確認していないですが、こんな感じで動かせると思います。
NAT Gatewayの名前はNameタグで設定するので"TagSpecifications"にある"Tags"で設定を行います。
https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ec2/client/create_nat_gateway.html
import boto3
ec2 = boto3.client('ec2')
def lambda_handler(event, context):
ec2.create_nat_gateway(
AllocationId='ElasticIPのID',
SubnetId='NAT Gatewayを設定するサブネットID',
TagSpecifications=[
{
'ResourceType': 'natgateway',
'Tags': [
{
'Key': 'Name',
'Value': 'NAT Gatewayに設定したい名前'
},
]
},
],
ConnectivityType='public'
)