小编Jor*_*dan的帖子

如何通过 Cloud Formation 将弹性 IP 连接到 NatGateway

我正在尝试学习 Aws cloud Formation ,我正在尝试创建 VPC,如图所示。它包含三个公共子网、私有子网、natg​​ateway 和 Internetgateway,以及公共和私有路由表。我试图通过云形成来实现它,但获得弹性 IP 的例外。 我正在尝试学习 Aws cloud Formation ,我正在尝试创建 VPC,如图所示。我已经创建了模板,但是当我尝试在云形成上创建堆栈时,出现错误

"The elastic-ip ID 'xx.xxx.xx.xxx' is malformed (Service: AmazonEC2; Status Code: 400; Error Code: InvalidElasticIpID.Malformed; Request ID: 2e3a9f8c-5a7e-482e-869c-8a0e46a08f27; Proxy: null)"
Run Code Online (Sandbox Code Playgroud)

。我正在尝试将弹性 IP 连接到 NatGateway 并出现上述错误。请指导我该怎么做。

{

{
  "AWSTemplateFormatVersion": "2010-09-09",
  "Resources": {
    "ExampleEc2Instance": {
      "Type": "AWS::EC2::Instance",
      "Properties": {
        "InstanceType": "t2.micro",
        "ImageId" : "ami-047a51fa27710816e",
        "AvailabilityZone" : "us-east-1a",
        "SecurityGroupIds" : [{
           "Ref":"ExampleSecurityGroup"
        }],
        "SubnetId" : {
           "Ref":"public2A"
        }
      }
    },"ExampleEc2InstancePrivate": {
      "Type": "AWS::EC2::Instance",
      "Properties": {
        "InstanceType": "t2.micro",
        "ImageId" : "ami-047a51fa27710816e",
        "AvailabilityZone" : "us-east-1a", …
Run Code Online (Sandbox Code Playgroud)

amazon-web-services aws-cloudformation aws-nat-gateway aws-cloudformation-custom-resource

5
推荐指数
1
解决办法
2302
查看次数

Django 模型 - 使用 Shell 插入外键值

我正在尝试通过 Django Shell 保存我的模型的值。我是 Django 的初学者。我已经装箱了三个模型。我在模型中逐一插入值。我首先创建了部门并插入了所有部门值。创建了学生并插入了所有与学生相关的值。现在我尝试在包含两个外键 StudentId 和 dept id 的课程中​​插入值。如何使用 Django Shell 为 Student 模型插入值。

    # -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models

# Create your models here.
from django.db import models
from django.utils import timezone

class Student(models.Model):
    studentId = models.AutoField(primary_key=True)
    firstname = models.CharField(max_length=50)
    middlename = models.CharField(max_length=1)
    lastname = models.CharField(max_length=50)
    city = models.CharField(max_length=200)
    registe_dt = models.DateTimeField(default=timezone.now())
    def __str__(self):
        return '%s %s %s' % (self.studentId, self.firstname,self.city)


class Dept(models.Model):
    deptId = models.AutoField(primary_key=True)
    deptName = models.CharField(max_length=200)
    def …
Run Code Online (Sandbox Code Playgroud)

django django-models

4
推荐指数
1
解决办法
8347
查看次数